Hi,

I am making a website in php that can display, add and update events on
google calendar.
Displaying and adding events already works but I am having trouble with
the update.

I use the PEAR HTTP Request class to do the http requests.
(http://pear.php.net/manual/en/package.http.http-request.php)

This is my php code for updating an event. It is a function in the
class gcal that I wrote my self:

function updateEvent($e_id, $e_author, $auth_email, $e_title,
$e_description, $e_url, $e_location, $e_start_date, $e_start_time,
$e_end_date, $e_end_time, $e_tags){
                $auth = new gAuth();
                $auth->requestClientLogin();

                $body = "<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:gd='http://schemas.google.com/g/2005'><category
scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2005#event'></category><title
type='text'>$e_title</title><content
type='text'>$e_description</content><author><name>$e_author</name><email>$auth_email</email></author><gd:transparency
value='http://schemas.google.com/g/2005#event.opaque'></gd:transparency><gd:eventStatus
value='http://schemas.google.com/g/2005#event.confirmed'></gd:eventStatus><gd:where
valueString='$e_location'></gd:where><gd:when
startTime='".$this->datetimeToAtomdate($e_start_date,$e_start_time)."'
endTime='".$this->datetimeToAtomdate($e_end_date,$e_end_time)."'></gd:when></entry>";

                $this->request->HTTP_Request($e_id, $this->requestParams);

                $this->request->addHeader('Authorization', "GoogleLogin
auth=".$auth->token);
                $this->request->setMethod('PUT');
                $this->request->addHeader('Content-Type', 
'application/atom+xml');
                $this->request->setBody($body);
                $this->request->sendRequest();
                switch ($this->request->getResponseCode()) {
                case 200:
                        $return = array(
                        'success' => true,
                        'code'  => $this->request->getResponseCode(),
                        'body' => $this->request->getResponseBody()
                        );
                        return $return;
                        break;
                default:
                        $return = array(
                        'success' => false,
                        'code'  => $this->request->getResponseCode(),
                        'body' => $this->request->getResponseBody()
                        );
                        return $return;
                }
        }

when I update an event it gives an 400 error:  No Content-Type header
As url for the request i use the url of the entry (it's id) that i got
from getting a list of the events. It looks like this:
http://www.google.com/calendar/feeds/{calendarcode}%40group.calendar.google.com/private-{entrycode}/full
is this the right url?

Can annyone help me with this or suggest an other sollution with fopen
or curl?

thanks


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to