Austin, I was able to create a calendar using the method you suggested. I would like to know how I share the calendar I create. Is it possible to add a parameter to the xml to turn on sharing so all can have read- only access? I read the API regarding ACLs but it is unclear how to implement that with php. Any help would be appreciated.
Jim On Jun 16, 1:13 pm, "Austin (Google)" <[EMAIL PROTECTED]> wrote: > Hi, > > Apologize in advance, 'cause I am going to post a solution with the Zend > library. There was a hack that I posted before using the Zend library to > create calendar. If you are interested you can take a look at this post - > > http://groups.google.com/group/google-calendar-help-dataapi/browse_th... > > Sorry that I am not too keen with CURL myself to help you with that. > > Hope it helps, > Austin > > On Fri, Jun 13, 2008 at 2:54 PM, nico <[EMAIL PROTECTED]> wrote: > > > Hello all, > > > I have tried all day yesterday to create a calendar both with curl and > > fsockets in php (note that ZEND is not an option for me at this time > > and I don't believe they allow for creating calendars anyway). I have > > tried many variations with setting up my http headers and tried to > > RTFM so to speak both in the gdata api docs and anywhere else I can, > > but I'm lost as to why I can't get this working. I get 411 even though > > I have Content-Length headers, input malformed-like errors, as well as > > various other fun errors depending on how I swap these around. > > Disclaimer: I usually don't 'hack' this bad, but I'm completely lost > > at this point ;) > > > Question: Does anyone have a 'working' simple example of either using > > curl or fsocketopen to create a calendar? Here are the relevent parts > > of the code for both that I'm mixed up on: > > > Curl: > > 2 attempts at setting the headers: > > ------------ Attempt 1-variations of the following: > > $header = array( > > "POST ".$url . "\r\n" . GDataMappily:: > > $GOOGLE_AUTHORIZACTION_HEADER_PREFIX . $AuthToken. "\r\n" . > > GDataMappily::$GOOGLE_X_IF_NO_REDIRECT. "\r\n" . > > GDataMappily::$GOOGLE_CONTENT_TYPE_ATOM_XML . "\r\n" . > > "Accept: text/xml" . "\r\n" . > > "Content-length: " .strlen($calEntry) . "\r\n\r\n" . > > $calEntry); > > ------------ Attempt 2-and also tried variations that looked like: > > $developerKey = MY_LONG_DEV_KEY_IS_HERE > > $header = array( 'Content-Type: application/atom+xml', > > 'Authorization: AuthSub token="' . $AuthToken . '"', > > 'X-Google-Key: key=' . $developerKey, > > 'Content-Length: ' . strlen($calEntry) > > ); > > --------------- > > // curl_setopt($ch, CURLOPT_URL, $url); > > // curl_setopt($ch, CURLOPT_HEADER, 1); // Need this to > > handle > > redirects > > // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); > > // //curl_setopt($ch, CURLOPT_TIMEOUT, 60); > > // curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST'); > > // curl_setopt($ch, CURLOPT_POSTFIELDS, $calEntry); > > // curl_setopt($ch, CURLOPT_HTTPHEADER, $header); > > > And then I tried variations of the following with raw headers: > > > $host = "www.google.com"; > > $path = '/calendar/feeds/default/owncalendars/full'; > > $developerKey = MYDEVKEY > > > //$out = "POST " . $path . " HTTP/1.1\r\n"; > > $out = "POST " . $path . "\r\n"; > > $out .= "Host: " . $host . "\r\n"; > > $out .= "Content-Length: " . strlen($calEntry) . "\r\n"; > > $out .= "Authorization: GoogleLogin auth" . '"' . $AuthToken . '"' . > > "\r\n"; > > $out .= "Content-Type: application/atom+xml\r\n\r\n"; > > //$out .= "X-Google-Key: key=" . $developerKey . "\r\n"; > > //$out .= "Connection: close\r\n\r\n"; > > $out .= $calEntry; > > > // And then fsocketsopen stuff here > > > Either help, or even better, a working example of using curl or raw > > headers in php (NOT Zend) to create a calendar would be deeply > > appreciated! Thanks all. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
