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 ] \n"; system("start $filename "); my $validCode = <STDIN>;
chomp $validCode ;
print "\$validCode is $validCode\n"; 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 . "\n";
print "11111111111111111111\n";
print $res->as_string(); print "11111111111111111111\n"; 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 . "\n"; print encode("gbk",decode("utf8",$res->as_string()));
上一篇:转帖: Serverless架构模式简介


下一篇:Android Volley框架的使用(三)