#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
use http::cookies;
use http::Request::Common;
my $cookies = http::cookies->new(
file => "cookies.txt",
autosave => 1,
);
my $ua = LWP::UserAgent->new();
$ua->cookie_jar($cookies);
my $req = http::Request->new(GET => "http://www.baidu.com/"); my $resp = $ua->request($req); if (( $resp->code() >= 200 ) && ($resp->code() < 400)) { print "yes\n"; } else { print "Error: ". $resp->status_line. "\n"; }
总结以上是内存溢出为你收集整理的perl捕捉cookies全部内容,希望文章能够帮你解决perl捕捉cookies所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)