<? $secure = 0; $session = 1; $scope = 'http://www.google.com/calendar/feeds'; $next = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"; $token = @$_GET['token']; // only a single use token if(!$token) { echo "<a href=\"https://www.google.com/accounts/AuthSubRequest?scope=$scope&session=$session&secure=$secure&next=$next\">Sign in to Google</a>"; exit; } $sessionToken = upgradeToken($token); echo "Single use token: $token\n"; echo "Session token: $sessionToken"; // TODO: get a feed function upgradeToken($token) { $ch = curl_init("https://www.google.com/accounts/AuthSubSessionToken"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: AuthSub token="' . trim($token) . '"' )); $result = curl_exec($ch); curl_close($ch); $splitStr = split("=", $result); return trim($splitStr[1]); } ?>
AuthSub using PHP's libcurl
Posted by
Eric (Google)
on
Friday, July 11, 2008
Subscribe to:
Post Comments (Atom)
2 comments:
yespornplease
yespornplease
yespornplease
nice post...keep up
Autocad centre in coimbatore | Autocad course in coimbatore | Autocad course fees in coimbatore | Electrical autocad course in coimbatore | Autocad course training in coimbatore | Best autocad course in coimbatore | Autocad course training with placement in coimbatore | Autocad online course in coimbatore | Autocad online training course in coimbatore | Autocad fees structure in coimbatore | Autocad solidworks jobs in coimbatore | cadd centre in coimbatore | cadd courses in coimbatore | cadd centre fees structure in coimbatore | Autocad training in coimbatore
Post a Comment