Re: php curl http header authorization in google blogger api

Giberno Morini <[email protected]>
Newsgroups gmane.comp.web.blogger.api
Message-ID <[email protected]>
Hi Madeleine,
Thanks for a replay, We are using wordpress nextend-google-connect plugin, 
the author using other sdk. for me, only know how to get the access token 
and user_id. I have tried `$blogger_service = new 
Google_BloggerService($client);` but it throw error. Any method or other 
wordpress login plugin use `Google_Client` sdk? thanks again.

Il giorno martedì 29 ottobre 2013 14:44:41 UTC+1, Madeleine Thompson ha 
scritto:
>
> It is probably easier to avoid curl and initialize a Google_Client the 
> same way as any other Google service.  For an installed application, there 
> is an example of that for Calendar at 
> http://stackoverflow.com/questions/10587542/google-api-unattended-reading-of-calendar-how-to-login, 
> though it looks like the class names may be old.  Once you have a 
> Google_Client, you can get a Google_BloggerService (instead of a 
> Google_CalendarService) from that with:
>
> $blogger_service = new Google_BloggerService($client);
>
>
> On Tue, Oct 29, 2013 at 3:57 AM, Giberno Morini <[email protected]<javascript:>
> > wrote:
>
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/bloggerdev.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.