我做了一个程序模拟登陆商都论坛
http://bbs.shangdu.com 抓包看都一样了但是还是提示用户名密码错误,谁知道为什么?
use HTTP::Cookies;
use HTTP::Request::Common qw(POST);
use LWP;
$ua = LWP::UserAgent->new;
$ua->agent('Opera/9.25 (Windows NT 5.2; U; zh-cn)');
$ua->default_header('Accept' => "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1");
$ua->default_header('Accept-Language' => "zh-CN,zh;q=0.9,en;q=0.8");
$ua->default_header('Content-Type' => "application/x-www-form-urlencoded");
$ua->default_header('Referer' => "http://usrbbs.shangdu.com/misc.cgi?action=login&return_url=http%3A%2F%2Fbbs.shangdu.com%2Fviewthread.cgi%3Ffid%3D48%26tid%3D1237991");
$ua->cookie_jar(HTTP::Cookies->new(file => "D:\\bin\\posttools\\bbsshangdudingtie\\data\\我是不知道\\cookie.txt",
autosave => 1));
$res = $ua->get('http://usrbbs.shangdu.com/misc.cgi?action=login&return_url=http://bbs.shangdu.com/forumdisplay.cgi/fid=48');
$res = $ua->get('http://usrbbs.shangdu.com/verifyimg.php?act=water');
$htms=$res->content;
open (PNG,'>D:\bin\posttools\bbsshangdudingtie\bin\1.png');
binmode(PNG);
print PNG $htms;
close PNG;
print "请编辑验证码 \n";
sleep 30;
open (FILE,'<D:\bin\posttools\bbsshangdudingtie\bin\number.txt'); #回过帖子的记录起来
$number= <FILE>;
close FILE;
$response = $ua->post( 'http://usrbbs.shangdu.com/misc.cgi?action=login',
[
return_url => 'http://bbs.shangdu.com/forumdisplay.cgi?fid=48',
registerhost => 'bbs.shangdu.com',
referer => 'http://bbs.shangdu.com/forumdisplay.cgi?fid=48',
UserName => '我是不知道',
Userpass => 'panwei',
number => $number,
loginsubmit => "会员登录",
loginsubmit22.x =>"27",
loginsubmit22.y =>"5"
]);
$html=$response->content;
open (FILE,'>D:\bin\posttools\bbsshangdudingtie\bin\cookiehtm.htm'); #回过帖子的记录起来
print FILE $html;
close FILE;
$ua->cookie_jar->save;
谁帮忙跟踪数据包看看到底怎么回事?