我无法使用以下脚本登录gmail帐户:
$email="email@gmail.com";
$password="password";
$gacookie="";
$ch = curl_init();
$postdata="Email=$email&Passwd=$password&continue=https://www.mail.google.com";
curl_setopt ($ch, CURLOPT_URL,"https://www.gmail.com");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $gacookie);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie);
curl_setopt ($ch, CURLOPT_REFERER, 'https://www.google.com');
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
curl_close($ch);
echo $result;<br>
有什么想法吗?
答案 0 :(得分:1)
可能存在重定向,此时您的帖子数据已消失。
尝试添加CURLOPT_POSTREDIR => 2
答案 1 :(得分:0)
尝试使用open inviter。开源