Re: [php] i can't post new posts to my blogger

Alexnadro Veerling <[email protected]>
Newsgroups gmane.comp.web.blogger.api
Message-ID <[email protected]>
laio could you please share all the code to create a post in blogger?

Cheers!

On Tuesday, November 5, 2013 10:09:36 AM UTC+2, Laio sen wrote:
>
> I find the reason, because the curl will go ask the correctness openssl 
> website, it will be stuck in the inquiry period
> Then just close the inquiry action.
> php code change like this:
>
> <?php
> $arr['api_key'] = {api key};
> $arr['token_id'] = {token};
> $arr['blog_id'] = {blogger id};
> $arr['tag'] = {tag};//like: test,google,blogger
> $arr['title'] = {title};
> $arr['content']= {content};
>  function post_in($arr){
> $to['url'] = "https://www.googleapis.com/blogger/v3/blogs/
> ".$arr['blog_id']."/posts?fields=id&key=".$arr['api_key'];
> $to['hand'] = array("Authorization: Bearer 
> ".$arr['token_id'],"Content-Type: application/json");
> $to['content'] = array(
> "blog"=>array( "id"=>$arr['blog_id']),
> "title"=>$arr['title'],
> 'labels'=>explode (',',$arr['tag']),
> "content"=>$arr['content']
> );
> $to['content']=json_encode($to['content']);
> $re = blogger_add($to);
> $temp = json_decode($re);
> return $temp->id;
> }
>  function blogger_add($arr){
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $arr['url']);
> curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_HTTPHEADER, $arr['hand']);
> curl_setopt($ch, CURLOPT_POSTFIELDS ,$arr['content']);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
> curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
> curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
> $re = curl_exec($ch);
> curl_close($ch);
> return $re;
> }
> ?>
>

-- 
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/d/optout.
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.