username:Perl_Login_Test
password:Km97Jc8YA0hBtDWa
username:Perl_Login_Test2
password:Km97Jc8YA0hBtDWb
username:Perl_Login_Test3
password:Km97Jc8YA0hBtDWc
username:Perl_Login_Test4
password:Km97Jc8YA0hBtDWd
username:Perl_Login_Test5
password:Km97Jc8YA0hBtDWe
username:Perl_Login_Test6
password:Km97Jc8YA0hBtDWf
####
https://passport.ganji.com/login.php?callback=jQuery18202400486817677826_1465784917412&username=Perl_Login_Test&password=Km9%24Jc8%23A0hb&checkCode=&setcookie=0&second=&parentfunc=&redirect_in_iframe=&next=%2F&__hash__=g9HXulwHOtjjvcVkbJJ3xO2sNdOiS%2F2orrB9fkSBiYSeqFdzpasFkX%2F7R2terabF&_=1465784941421
####
#!/usr/bin/perl
$|=1;
use Time::HiRes qw/time/;
use Data::Dumper;
use Mojo::UserAgent;
use Mojo::UserAgent::CookieJar;
my $ua=Mojo::UserAgent->new;
$ua=$ua->inactivity_timeout(10);
$ua = $ua->max_redirects(10);
my $jar=Mojo::UserAgent::CookieJar->new;
$ua = $ua->cookie_jar($jar);
my $time1;
my $hash;
my $login=$ua->get('https://passport.ganji.com/login.php?next=/'=>{
'Host'=>'passport.ganji.com',
'User-Agent'=>'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0',
'Accept'=>'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language'=>'en-US,en;q=0.5',
'Accept-Encoding'=>'gzip, deflate;',
'Connection'=>'keep-alive',
});
if(my $res0=$login->success){
my $body0=$res0->body;
if($body0=~m/"display: none">(\d{13})\<\/div\>/){
$time1=$1;
}
if($body0=~m/\_\_hash\_\_ \= '(.*?)\'\;/){
$hash=$1;
}
}
my $time2=time;
$time2=~s/\.//;
$time2=~m/^(\d{13})/;
$time2=$1;
my $url='https://passport.ganji.com/login.php?callback=jQuery18207831563733301097_'.$time1.'&username=Perl_Login_Test&password=Km97Jc8YA0hBtDWa&checkCode=&setcookie=0&second=&parentfunc=&redirect_in_iframe=&next=%2F&__hash__='.$hash.'&_='.$time2;
my $tx=$ua->post($url=>{
'Host'=>'passport.ganji.com',
'User-Agent'=>'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0',
'Accept'=>'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01',
'Accept-Language'=>'en-US,en;q=0.5',
'Accept-Encoding'=>'gzip, deflate;',
'X-Requested-With'=>'XMLHttpRequest',
'Referer'=>'https://passport.ganji.com/login.php?next=/',
'Connection'=>'keep-alive',
});
if(my $res=$tx->success){
print Dumper ($res);
my $gh=$ua->get('http://www.ganji.com/user/login_success.php?username=Perl_Login_Test&next=%2F&second=');
if(my $res2=$gh->success){
my $body2=$res2->body;
print "$body2\n";
}
}
else{
print "ERROR!!!\n";
}