大家好,我正在尝试使用 zend 框架更新我的谷歌联系人,但出现以下错误:
Expected response code 200, got 403 If-Match or If-None-Match header or entry etag attribute required
以下是我的代码:
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_Feed');
$client = getGoogleClient('cp'); // this is a function I made - its working fine
$client->setHeaders('If-Match: *');
$gdata = new Zend_Gdata($client);
$gdata->setMajorProtocolVersion(3);
$query = new Zend_Gdata_Query($id);// id is the google reference
$entry = $gdata->getEntry($query);
$xml = simplexml_load_string($entry->getXML());
$xml->name->fullName = trim($contact->first_name).' '.trim($contact->last_name);
$entryResult = $gdata->updateEntry($xml->saveXML(), $id);
这是怎么回事?