$response->decoded_content; 和$response->content; 乱码问题

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 = $ua->get($var);


if ($response->is_success) {
$var= $response->decoded_content;
print "\$var is $var\n";
};


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 = $ua->get($var);


if ($response->is_success) {
$var= $response->content;
print "\$var is $var\n";
};

posted @   czcb  阅读(126)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示