via 脚本自动更新(2014-11-08 22:51:31)
自动登录
define(‘ROOT_PATH‘,__DIR__); include_once(ROOT_PATH.‘/lib/Http.class.php‘); $config=array( ‘username‘=>‘*******‘, ‘password‘=>‘*******‘ ); $cookie=array(); //获取login_sig $url="http://ui.ptlogin2.qq.com/cgi-bin/login"; $data=array( "hide_title_bar"=>"1", "low_login"=>"0", "qlogin_auto_login"=>"0", "no_verifyimg"=>"1", "link_target"=>"blank", "appid"=>"636014201", "target"=>"self", "s_url"=>"http://qzone.qq.com", ); $resp=Http::httpGet($url,$data); $cookie[‘uikey‘]=$resp[‘header‘][‘Cookies‘][‘uikey‘]; $matches=array(); $pattern="/" .preg_quote(‘g_login_sig=encodeURIComponent("‘) ."(\S+)" .preg_quote(‘")‘) ."/"; preg_match($pattern,$resp[‘body‘],$matches); $login_sig=$matches[1]; //获取verifycode、pt_verifysession_v1、uin $url="http://check.ptlogin2.qq.com/check"; $data=array( ‘uin‘=>$config[‘username‘], ‘appid‘=>‘636014201‘, ‘js_ver‘=>‘10100‘, ‘js_type‘=>‘0‘, ‘login_sig‘=>‘0‘, ‘u1‘=>‘http://qzone.qq.com‘, ‘r‘=>‘0.‘.rand(10000000,99999999).time(), ); $resp=Http::httpGet($url,$data); // print_r($resp[‘body‘].PHP_EOL); $cookie=Arr::merge($cookie,$resp[‘header‘][‘Cookies‘]); $matches=array(); preg_match("/ptui_checkVC\((.+)\)/", $resp[‘body‘],$matches); $res=explode(‘,‘,$matches[1]); $verifycode=trim(trim($res[1]),"‘"); $uin=hex2str(trim(trim($res[2]),"‘")); $pt_verifysession_v1=trim(trim($res[3]),"‘"); //获取密码 function getP(){ global $config,$uin,$verifycode; $j=hex2bin(strtoupper(md5($config[‘password‘]))); $h=strtoupper(md5($j.$uin)); $p=strtoupper(md5($h.strtoupper($verifycode))); return $p; } $url="http://ptlogin2.qq.com/login"; $data=array( "u"=>$config[‘username‘], "p"=>getP(), "verifycode"=>$verifycode, "aid"=>"636014201", "u1"=>"http://qzone.qq.com", "h"=>"1", "ptredirect"=>"0", "ptlang"=>"2052", "from_ui"=>"1", "dumy"=>"", "fp"=>"loginerroralert", "action"=>"1-1-10000", "mibao_css"=>"", "t"=>"1", "g"=>"1", "js_type"=>"0", "js_ver"=>"10100", //跟g_login_sig有关 "login_sig"=>$login_sig, "pt_uistyle"=>"0", "pt_vcode_v1"=>"0", "pt_verifysession_v1"=>$pt_verifysession_v1, ); $resp=Http::httpGet($url,$data); print_r($resp[‘body‘]); function hex2str($hexstr){ $res=explode(‘\x‘, $hexstr); $str=""; foreach($res as $key=>$val){ if(empty($val))continue; $str.=chr(hexdec($val)); } return $str; }
时间: 2024-11-06 13:33:28