谷歌已經用他們的日曆API找到了一些東西,現在我需要修復一些將自己添加到文本中的奇怪符號。我發現這個線程這正好說明我處理這個問題: http://www.google.com/support/forum/p/Calendar/thread?tid=25ac3d762b235a51&hl=en如何將querystring追加到對象?
解決的辦法是追加「& HL = en」或「HL =恩?」我的「基本」 URL加料結束。
我confunsed如何做到這一點,雖然,因爲我檢索飼料與Zend_Gdata對象:
<?php
// load library
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
Zend_Loader::loadClass('Zend_Http_Client');
// create authenticated HTTP client for Calendar service
$gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = "xxxxx";
$pass = "xxxxx";
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
$gcal = new Zend_Gdata_Calendar($client);
$query = $gcal->newEventQuery();
$query->setUser('[email protected]');
$secondary=true;
$query->setVisibility('private');
$query->setProjection('basic');
$query->setOrderby('starttime');
$query->setSortOrder('ascending');
//$query->setFutureevents('true');
$startDate=date('Y-m-d h:i:s');
$endDate="2015-12-31";
$query->setStartMin($startDate);
$query->setStartMax($endDate);
$query->setMaxResults(30);
try {
$feed = $gcal->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
echo "Error: " . $e->getResponse();
}
?>
我試過,沒有運氣做到這一點:
$query->setProjection('basic?hl=en');
嘿,夥計,那工作!非常感謝! – Joel 2011-03-20 07:23:16