Search This Site

Custom Search

Friday, September 24, 2010

[bloggerDev] Not able to post using Blogger API

When i post using Blogger API it does not respond with any error but
it also does not post to the specific feed or blog. But it respond
with http code '0'. Kindly help me debug the code.
Following is my code:

$authSubHeader = self::getAuthHeader("POST", $url, $token);

$xml = "<entry xmlns='http://www.w3.org/2005/Atom'>
<title type='text'>".urlencode($title)."</title>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/
xhtml'><p>".urlencode($body)."</p></div>
</content>
</entry>";


$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:
application/atom+xml", "Content-Length: ".strlen($xml),
$authSubHeader, "$xml"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

$response = curl_exec ($ch);

curl_close ($ch);

Thanks in Advance

--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.

No comments:

Post a Comment