php curl http header authorization in google blogger api
Giberno Morini <[email protected]>
| Newsgroups | gmane.comp.web.blogger.api |
|---|---|
| Message-ID | <[email protected]> |
there has few articles about google blogger api, so i have some question
about it. I have access passing OAuth 2.0, get access token like ya29., now
how to use access token, api key,user_id, to get blogger user info, blogger
user post?
I am not find any examples use Google_BloggerService.php, so i tried use
curl code below:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.googleapis.com/blogger/v3/users/".$user_id."/blogs?key=".$api_key);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$header = array();
$header[] = 'Content-length: 0';
$header[] = 'Content-type: application/json';
$header[] = 'Authorization:'.$access_token;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$html = curl_exec($ch);
curl_close($ch);
echo $html;
But always return: { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } } I have no idea how to solve it, maybe some one could help me out of this question, Thanks and regards.
--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/bloggerdev.
For more options, visit https://groups.google.com/groups/opt_out.