开发者

Problem with AuthSubSessionToken PHP

开发者 https://www.devze.com 2023-03-14 15:15 出处:网络
if I try to get a Session Token from google the server doesn\'t respond.. The code that I use is this:

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开发者_JAVA百科 is correct because I can use it as Single-use token..


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()


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号