我曾经WWW::Mechanize登录到该网站。
现在我们已经登录,我想让WWW::Mechanize脚本转到payments.php然后找到活动用户订阅(例如 VIP 访问)(类:)<p class="description">。
从这里我想阅读那是什么,然后选择正确的动作。例如,如果用户打包状态VIP Small然后打印PKG: VIP Small,如果用户打包状态VIP Full然后打印PKG: VIP Full。
有谁知道这样做的方法?到目前为止使用的代码(在我的 Ubuntu 虚拟机中编码):
#!/usr/bin/perl
use WWW::Mechanize;
my $forum = "http://localhost/forums/forum.php";
print "Username\r\n";
my $username = <>;
chomp($username);
print "Password\r\n";
my $password = <>;
# do login
my $mech = WWW::Mechanize->new(agentcheck => 1, agent => 'Perl WWW::Mechanize');
$mech->get($forum);
$mech->submit_form(form_number => 1, fields => { vb_login_username => $username, vb_login_password = $password });
print "this far";
$mech->follow_link(text => "Click here if your browser does not automatically redirect you.");