[php] i can't post new posts to my blogger
Laio sen <[email protected]>
| Newsgroups | gmane.comp.web.blogger.api |
|---|---|
| Message-ID | <[email protected]> |
$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.