tags:

views:

4

answers:

0

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'&gt;
              <title type='text'>".urlencode($title)."</title>
              <content type='xhtml'>
                <div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;p&gt;".urlencode($body)."&lt;/p&gt;&lt;/div&gt;
              </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