• perl 自动登陆网站发短信


    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;
    use URI::Escape;  
    use File::Temp qw/tempfile/;
    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';
    
    
    my $response = $ua->get("http://121.52.220.246:8888/code.aspx");
    
    
    
    if ($response->is_success) {
      $r = $response->decoded_content;   
    # print $response->decoded_content;  # or whatever
    }
    else {
     die $response->status_line;
    };
    
    my ( $fh, $filename ) =
      tempfile( "sms_qrcode_XXXX", SUFFIX => ".jpg", DIR => 'c:\' );
    binmode $fh;
    print $fh $r;
    close $fh;
    my $code=encode("gbk",decode("utf8",'请输入验证码'));
    print "$code.[ $filename ] 
    ";
    
    system("start $filename ");
    
    my $validCode = <STDIN>;
    chomp $validCode ;
    print "$validCode is $validCode
    ";
    
    
     my $login_url = 'http://121.52.220.246:8888/chklogin.aspx';
                    
     my $res = $ua->post($login_url,{
    	                       'account'=>'sc10624',
                              'action'=>'login',
    						  'code'=>$validCode,
                              'password'=>'xx'
    						
                        
                                                    });
    
           my $content = $res->content();
           
                print $res->status_line . "
    ";
                print "11111111111111111111
    ";
                print $res->as_string();                print "11111111111111111111
    ";
              
           my $Sign=uri_escape('【中均】');
    #http://121.52.220.246:8888/checkkeyword.aspx?action=add
           my $str=(rand(1));
    	   my $login_url = 'http://121.52.220.246:8888/checkkeyword.aspx?action=add';	
    	   my $res = $ua->post($login_url,{
    	                       'content'=>uri_escape('ABCDEFG'),
                              'keySign'=>"$str"
    
                                                    });
    	
    print encode("gbk",decode("utf8",$res->as_string())); 
    my $login_url = 'http://121.52.220.246:8888/submitsms.aspx';
    
    #%E3%80%90%E4%B8%AD%E5%9D%87%E3%80%91
                    
           my $res = $ua->post($login_url,{
                              'mobile'=>18072xx,
    						  'mobilenumber'=>1,
    						  'telephonenumber'=>0,
                              'iscall'=>1,
    						   'msgcontent'=>uri_escape('ABCDEFG'),
    						  'checkcontent'=>1,
    						  'countnumber'=>1,
    						 'usign'=>'【中均】',
    						  'useUserSign'=>1,
    						  'forceID'=>'undefined'},
    						  'User-Agent'=>'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
                    'Host'=>'121.52.220.246:8888',
                    'Referer'=>'http://121.52.220.246:8888/send.aspx'	,
    				'X-Requested-With'=>'XMLHttpRequest'
    						  
                                                    
                            );
                my $content = $res->content();
                print  encode("gbk",decode("utf8",$content));
                print $res->status_line . "
    ";
                
                print encode("gbk",decode("utf8",$res->as_string()));   
                
    			
    			

  • 相关阅读:
    ASP.NET MVC2 in Action 读书笔记 [121] Custom Ajax
    [转] 浅谈 MVC3 WebMail 发送邮件
    JQuery学习笔记 (3)
    ASP.NET MVC2 in Action 读书笔记 [1]
    [转] 在ASP.NET MVC3中使用EFCodeFirst 1.0
    LINQ ForEach
    JQuery学习笔记 [Ajax实现新闻点评功能] (63)
    [转] .NET2005下单元测试中Assert类的用法
    [转] ASP.NET MVC3 路由和多数据集的返回
    ASP.NET MVC2 in Action 读书笔记 [124] MVC Ajax Helpers
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350560.html
Copyright © 2020-2023  润新知