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

[email protected]
Newsgroups gmane.comp.web.blogger.api
Message-ID <[email protected]>
Maybe the order of you curl option could cause the problem:
* curl_setopt($ch, CURLOPT_URL, $url);*
* curl_setopt($ch, CURLOPT_HTTPHEADER, $hand);*
* curl_setopt($ch, CURLOPT_POST, true);*
* curl_setopt($ch, CURLOPT_POSTFIELDS ,$content);*
* curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);  *


On Monday, October 14, 2013 2:23:17 AM UTC-8, Laio sen wrote:
>
> $api_key = {api key};
> $token_id = {token};
> $arr['blog_id'] = {blogger id};
> $arr['tag'] = {tag]';
> $arr['title'] = {title};
> $arr['content']= {content};
>  $url = "https://www.googleapis.com/blogger/v3/blogs/
> ".$arr['blog_id']."/posts?fields=id&key=".$api_key;
> $hand = array("Content-Type:  application/json","Authorization:  Bearer 
> ".$token_id);
> $content = array(
> "title"=>$arr['title'],
> 'labels'=>explode (',',$arr['tag']),
> "content"=>$arr['content']
> );
> $content=json_encode($content);
> print_r($url);
> echo "<br>";
> print_r($hand);
> echo "<br>";
> print_r($content);
> echo "<br>";
>  $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $url);
> curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_HTTPHEADER, $hand);
> curl_setopt($ch, CURLOPT_POSTFIELDS ,$content);
> curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);  
> $re = curl_exec($ch);
> var_dump($re);
> curl_close($ch);
>
> this is my php code, i try curl post my blog, but is not insert.
> i don't know why.
>

-- 
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.