Why have you commented out this line? > //$header[] = "Content-length: ".strlen($_entry);
The error message is saying that you haven't included a Content-length header and you aren't including a Content-length header. Is there something else that you aren't telling us? Ray On Thu, May 14, 2009 at 2:11 AM, lisandru20 <[email protected]> wrote: > > Hello, > > I'm using libcurl PHP to get atom feeds from my google calendar. > > - For anthentification it's OK > - To GET my calendar list it's OK > - But I have a problem to add an event (POST > http://www.google.com/calendar/feeds/default/private/full ) using > documention (http://code.google.com/intl/fr/apis/calendar/docs/2.0/ > developers_guide_protocol.html#Auth.) and I don't want to use > Zend_Gdata to do it. > > I have an error message: > > Length Required > POST requests require a Content-length header. > > Here is my code > > $header = array(); > $header[] = "Host: localhost"; > $header[] = "MIME-Version: 1.0"; > $header[] = "Accept: text/xml;"; > $header[] = "Authorization: GoogleLogin auth=".$hasil[1]; // > AuthUserToken > //$header[] = "Content-length: ".strlen($_entry); > $header[] = "Content-type: application/atom+xml"; > $header[] = "Cache-Control: no-cache"; > $header[] = "Transfer-Encoding: Chunked"; > $header[] = "Connection: close \r\n"; > $header[] = $_entry; > > $ch = curl_init(); > curl_setopt($ch, CURLOPT_URL,"https://www.google.com/calendar/feeds/ > default/private/full"); > curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); > curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true); > curl_setopt($ch,CURLOPT_REFERER, "http://google.com"); > curl_setopt($ch,CURLOPT_VERBOSE, true); > curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); > curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, false); > curl_setopt($ch,CURLOPT_HEADER, true); > curl_setopt($ch,CURLOPT_NOBODY, false); > curl_setopt($ch,CURLOPT_COOKIEJAR, $fCookieFile); > curl_setopt($ch,CURLOPT_COOKIEFILE, $fCookieFile); > curl_setopt($ch,CURLOPT_POST, 1); > curl_setopt($ch,CURLOPT_POSTFIELDS, $post_data); > curl_setopt($ch,CURLOPT_CUSTOMREQUEST,'POST'); > curl_setopt($ch,CURLOPT_HTTPHEADER, $header); > > > I can't find a solution without using Zend_Gdata. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
