- 论坛徽章:
- 0
|
将请求发送到web,代码如下
$ua = LWP::UserAgent->new() or die print"error!\n";
$response = $ua->request(POST 'http://xyy.com/UserLogin.do',
'Accept'=> 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*',
'Referer'=> 'http://xyy.com/',
'Accept-Language'=> 'zh-cn',
'Content-Type'=> 'application/x-www-form-urlencoded',
'Accept-Encoding'=> 'gzip, deflate',
'User-Agent'=> 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)',
'Host' => 'xyy.com',
'Connection' => 'Keep-Alive',
'Cache-Control' => 'no-cache',
'Content' => ['state' => 'login',
'username' => 'bob',
'password' => '123',
'selLanguage' => 'zh_CN',
'lawEmp' => 'on',
'B1' => '%AF%A2%E7%86%8E%E5%AE%B9]']
) or die "error request\n";
问题是,我将Connection 置为Keep-Alive,为什么我发送请求后,返回内容后连接就关闭了,从我捕获的数据包来看,Connection 的值并不是Keep-Alive,而是奇怪的 Keep-Alive, TE, close,请各位大侠赐教 |
|