研究了很久,结果不好,老是返回登录页面。我已经设置了帖子参数、标题、代理......
我使用 FireFox 的 Live HTTP Headers 插件来查看 POST 内容包含什么,然后将其设置为我的代码,但它仍然无法正常工作。这是我的代码:
function show($content)
{
echo "<textarea>$content</textarea>";
}
function aol($mail,$pass, $_sock){
$url="http://mail.aol.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($ch, CURLOPT_PROXY, $_sock);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$content=curl_exec ($ch);
$this->show($content);
//Get SNS_SC
$SNS_SC=explode('SNS_SC=', $content);
$SNS_SC=explode(';', $SNS_SC[1]);
$SNS_SC=$SNS_SC[0];
// //Get Site State
$siteState=explode('siteState" value="', $content);
$siteState=explode('"', $siteState[1]);
$siteState=$siteState[0];
//Get usrd
$usrd=explode('usrd" value="', $content);
$usrd=explode('"', $usrd[1]);
$usrd=$usrd[0];
$url="https://my.screenname.aol.com/_cqr/login/login.psp";
$post="sitedomain=sns.webmail.aol.com&siteId=&lang=en&locale=us&authLev=0&siteState=$siteState&isSiteStateEncoded=true&mcState=initialized&uitype=std&use_aam=0&offerId=newmail-en-us-v2&seamless=novl®PromoCode=&usrd=$usrd&doSSL=&redirType=&xchk=false&tab=&lsoDP=&loginId=$mail&password=$pass";
//ref
$ref="https://my.screenname.aol.com/_cqr/login/login.psp?sitedomain=sns.webmail.aol.com&lang=en&seamless=novl&offerId=newmail-en-us-v2&authLev=0&siteState=$siteState&locale=us";
//
$arr[] = "Host: my.screenname.aol.com";
$arr[] = "User-Agent: Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1";
$arr[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
$arr[] = "Accept-Language: en-us,en;q=0.5";
$arr[]="Accept-Encoding: gzip, deflate";
$arr[]="Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$arr[] = "Keep-Alive: 300";
$arr[] = "Connection: keep-alive";
$arr[] = "Referer: ".$ref;
$arr[] = "Cookie: SNS_SC=" . $SNS_SC ;
$arr[] = "Content-Type: application/x-www-form-urlencoded";
$arr[] = "Content-Length: " . strlen($post);
//$arr[] = $post;
//
curl_setopt($ch, CURLOPT_HEADER, $arr);
curl_setopt($ch, CURLOPT_POST ,1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $ref);
$result=curl_exec ($ch);
curl_close ($ch);
//$this->show($result);
echo $result;
return 0;
}
任何想法?谢谢 :)