0

if I try to get a Session Token from google the server doesn't respond.. The code that I use is this:

  $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]);

but the server doesn't respond..No error code..nothing of nothing.. :( The token that I take from https://www.google.com/accounts/AuthSubRequest is correct because I can use it as Single-use token..

Michele
  • 3
  • 1

2 Answers2

1

Just to check - have you checked your apache error logs? /var/log/httpd (or apache2) on linux?

Make sure full error reporting is on too! Drop this at the top of the page

ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);

EDIT:

Also try this:

echo 'Curl error: ' . curl_error($ch);

just before curl_close()

kieran
  • 2,304
  • 4
  • 28
  • 44
  • There aren't errors :( The $splitStr is empty and I think that is because the server doesn't respond..There is a library like CURL that I can use to contact the server of google? – Michele Jun 22 '11 at 13:56
0

Dunno if you figured it out, the problem is that you should request the first token using session=1, if you use session=0 the request won't work (mine was failing with 403)

doterobcn
  • 307
  • 1
  • 4
  • 15