zoukankan      html  css  js  c++  java
  • $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
    ";
    };
    
    
    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皇后问题
    [2011山东ACM省赛] Sequence (动态规划)
    yaf 学习
    nginx 配置文件
    nginx.conf 理解
    fastcgi
    Nginx+FastCGI运行原理
    ssh-key 原理
    Git是个啥 ssh是个啥
    Git SSH Key 生成步骤
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6198941.html
Copyright © 2011-2022 走看看