保存cookie到本地,发送请求时带着cookie。


use Data::Dumper;
use LWP::UserAgent;
use URI;
use HTTP::Date;
use Encode;
use HTTP::Cookies;


my $cookie_jar = HTTP::Cookies->new(file => "d:cookies.lwp",autosave => 1);
my $browser = LWP::UserAgent->new;
$browser->cookie_jar( $cookie_jar );

my $res = $browser->get('http://kailani-exclusive.com/pc/item/detail.cgi?itemCd=050_10642&itemClcd=22');

print decode 'Shift_JIS',$res->content;

你可能感兴趣的:(perl)