centos6.5:/root/podinns/lib#cat t1.pl
use LWP::UserAgent;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
use Net::Ping;
use Socket;
use Net::SMTP;
use LWP;
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Headers;
use HTTP::Response;
use Encode;
use URI::Escape;
use URI::URL;
my $ua = LWP::UserAgent->new;
$ua->timeout(5);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
my $cookie_jar = HTTP::Cookies->new(
file=>'lwp_cookies.txt',
autosave=>1,
ignore_discard=>1);
$ua->cookie_jar($cookie_jar);
$var='https://licai.yingyinglicai.com/index.htm';
#$var='https://licai.yingyinglicai.com/user/loginByPwd.do';
my $response =
$response->decoded_content; 和$response->content; 乱码问题
最新推荐文章于 2022-02-10 15:29:51 发布
这篇博客探讨了在使用Perl模块LWP::UserAgent进行HTTP请求时,遇到的响应内容乱码问题。通过分析代码片段,可以看到作者尝试从'https://licai.yingyinglicai.com/index.htm'获取内容,并分别使用$response->decoded_content和$response->content来获取,然后打印出来。遇到的问题可能涉及到字符编码和解码,以及HTTP响应的正确处理。
摘要由CSDN通过智能技术生成