I've read multiple answers from around the Internet and I've tried
every combination that I can think of to get this URL error to go
away. I've heard a lot about using the auto generated URL and I've
tried to implement that code, but only received more errors.
I'm obviously trying to build the url myself and I'm doing it with the
email as username.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Here's the function
function insertEvent ( $title,$where,$content,$startDate,$startTime,
$endDate,$endTime,$CalendarID,$CalendarURL ) {
$CalendarURL = "http://www.google.com/calendar/
feeds/".CALENDAR_USERNAME."/private/full";
// $CalendarURL = "http://www.google.com/calendar/feeds/".
$CalendarURL."/private/full";
// $CalendarURL =
'http://www.google.com/calendar/feeds/default/
private/full';
//Validate elements' format.if not jump the insert
if( preg_match( "/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/i", $startDate )
&& preg_match( "/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/i", $endDate )
&& ( preg_match( "/[0-9]{1,2}:[0-9]{2}/i", $startTime ) ||
$startTime=="all_day" )
&& ( preg_match( "/[0-9]{1,2}:[0-9]{2}/i", $endTime ) ||
$endTime=="all_day" ) ) {
try {
$event= $this->gdataCal->newEventEntry();
// Populate the event with the desired
information
// Note that each attribute is created as an
instance of a
matching class
$event->title =
$this->gdataCal->newTitle( $title );
$event->where =
array($this->gdataCal->newWhere( $where ));
$event->content =
$this->gdataCal->newContent( $content );
$when = $this->gdataCal->newWhen();
if ($startTime=='all_day') {
$when->startTime =
"{$startDate}{$this->tzOffset}:00";
} else {
$when->startTime =
"{$startDate}T{$startTime}:00.000{$this-
>tzOffset}:00";
}
if ($endTime=='all_day') {
$when->endTime =
"{$endDate}{$this->tzOffset}:00";
} else {
$when->endTime =
"{$endDate}T{$endTime}:00.000{$this->tzOffset}:
00";
}
$event->when = array($when);
// Upload the event to the calendar server
// A copy of the event as it is recorded on the
server is returned
$newEvent = $this->gdataCal->insertEvent(
$event, $CalendarURL );
return $newEvent;
////////////////////////////////////////////////////////////////////////////////////////////////////
// Catching the error
} catch (Zend_Gdata_App_HttpException $e) {
echo "<BR><BR>Error: " . $e->getMessage() .
"<br />\n";
if ($e->getResponse() != null) {
echo "Body: <br />\n" .
$e->getResponse()->getBody() . "<br />
\n";
}
}
}else {
// Was not successful at adding an event to the
calendar because
of the date format
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---