Php Zend Gdata日历API返回“;不支持3.0版。”;
执行简单日历提取时收到以下错误:Php Zend Gdata日历API返回“;不支持3.0版。”;,php,google-api,google-apps-marketplace,Php,Google Api,Google Apps Marketplace,执行简单日历提取时收到以下错误: Expected response code 200, got 403 Version 3.0 is not supported. 代码如下所示: 非统组织 日历查询 $calendarClient = new Zend_Gdata_Calendar(Oauth::I()->getHttpClient()); print $calendarClient->getMajorProtocolVersion(); $query = $calendarC
Expected response code 200, got 403
Version 3.0 is not supported.
代码如下所示:
非统组织
日历查询
$calendarClient = new Zend_Gdata_Calendar(Oauth::I()->getHttpClient());
print $calendarClient->getMajorProtocolVersion();
$query = $calendarClient->newEventQuery();
$query->setUser('default');
$query->setVisibility('private');
$query->setProjection('full');
Oauth::I()->setRequestorId($query);
try {
$list = $calendarClient->getCalendarEventEntry($query);
var_dump($list);
} catch(Exception $e) {
var_dump($e->getMessage());
}
var_dump($calendarEventsFeed);
在Zend_Http_Client_Adapter_Socket资源头下转储$calenderClient时:
["gdata-version"]=>
array(2) {
[0]=>
string(13) "GData-Version"
[1]=>
string(3) "3.0"
}
但是getMajorProtocolVersion()返回1。解决方案是在需要更改GData版本时在HTTP客户端上设置Headers()。我确信有专门的方法来解决这个问题,但这是可行的
// $http_client is Zend_Oauth_Token_Access()::getHttpClient()
$http_client->setHeaders('GData-Version', '2.0');
// $http_client is Zend_Oauth_Token_Access()::getHttpClient()
$http_client->setHeaders('GData-Version', '2.0');