如何在头中设置cookie呢?
比如我要发送这个请求。头中有ssic这个值;
部分脚本片段;

sub test() {
        my $ua = LWP::UserAgent->new;
   #  my $cookie = HTTP::Cookies->new()
        my $header = HTTP::Headers->new(Content_Type => 
'application/oct-stream',
        User_Agent => 'IIC2.0/PC 3.2.0540',
    Pragma => 'xz4BBcVc7cb3392-ac94-48f7-9e6c-9cb651f00bb1',
    Cookie => "ssic=$hash{'ssic'}",
    Proxy_Connection => 'Keep-Alive');
       my $request = HTTP::Request->new("GET", $_[0], $header);
    #$cookie->add_cookie_header($request);
      my $response = $ua->request($request);
      print $response->content();
      print $response->status_line();
}
&test('http://221.130.44.194/ht/sd.aspx?t=i&i=1');

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。
 要在此论坛发帖,请发电子邮件到 [email protected]
 要退订此论坛,请发邮件至 [email protected]
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

回复