perl捕捉cookies

perl捕捉cookies,第1张

概述#!/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 $

#!/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所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1293050.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存