curl-and-php
auto login
Date: Wed, 23 Apr 2008 12:35:43 +0530
hi,
I have been trying auto logins for gmail,yahoo,rediff,myspace etc.. my
gmail code is as follows:
$username=urlencode('emailaddr');
$password="password";
$gacookie="./.gmcookie";
//&service=blogger
$postdata="Email=$username&Passwd=$password
&GA3T=5AS_gBsvDHI&nui=15&fpui=3&"."&ifr=true&rm=hide&itmpl=true&hl=en_US&alwf=true&continue=
http://www.google.com/mail";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,"
https://www.google.com/accounts/ServiceLoginBoxAuth");
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/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fnsr%3D1%26ui%3Dhtml%26zy%3Dl<mpl=default<mplcache=2');
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
curl_close($ch);
echo $result;
unlink($gacookie);
exit;
the program works perfectly fine for all google accounts! now the problem is
with yahoo..... i have been trying different urls for CURLOPT_URL and
CURLOPT_REFERER. but all the tries ultimately lead to yahoo homepage not the
login page. Can anyone please suggest me what to do and where im going
wrong?
thanks in advance,
rashmi.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-04-23