Hi
i am getting this error when creating a new calendar name ,please
help
code is here
$gCalendar = new ModelsModelgCalendar();
/
*--------------------------------------------------------------------
* Getting a valid token
*/
$my_calendar =
'http://www.google.com/calendar/feeds/default/private/
full';
//echo "SESS-->".$_SESSION['cal_token'];
if (!isset($_SESSION['cal_token'])) {
if (isset($_GET['token'])) {
// You can convert the single-use token to a
session token.
$session_token =
Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
// Store the session token in our session.
$_SESSION['cal_token'] = $session_token;
} else {
// Display link to generate single-use token
$googleUri =
Zend_Gdata_AuthSub::getAuthSubTokenUri(
'http://'. $_SERVER['SERVER_NAME'] .
$_SERVER['REQUEST_URI'],
$my_calendar, 0, 1);
echo "Click <a href='$googleUri'>here</a> " .
"to authorize this application.";
exit();
}
}
// Create an authenticated HTTP Client to talk to Google.
//$client = Zend_Gdata_AuthSub::getHttpClient($_SESSION
['cal_token']);
// Create a Gdata object using the authenticated Http Client
//$cal = new Zend_Gdata_Calendar($client);
//print_r($GLOBALS['googleToken']['Auth']);
/
*--------------------------------------------------------------------
* Needs a valid token
*/
$ContentLength = strlen($data);
$header = "POST $url HTTP/1.0 \r\n";
$header .= "Content-type:
application/atom+xml \r\n";
$header .= "Content-length:
".$ContentLength." \r\n";
//$header .= "Authorization: GoogleLogin
auth=".$GLOBALS
['googleToken']['Auth'].' \r\n'; // AuthUserToken
$header .= "Authorization: AuthSub
token=".$_SESSION
['cal_token']." \r\n"; //Token invalid - AuthSub token has wrong scope
$header .= "Cache-Control: no-cache ";
$header .= "Transfer-Encoding: Chunked
\r\n";
$header .= "Connection: close \r\n\r\n";
$header .= $data;
//echo $header;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
$results = curl_exec($ch);
if(curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
return $results;
}
Please help any one
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---