views:

120

answers:

0

Hi guys I'm following the example code as defined on this website: http://www.ibm.com/developerworks/opensource/library/x-phpgooglecontact/index.html

I want to be able to integrate with my google apps account and play around with teh contacts. However I get this error whenever I try to run the modify contacts code:

If-Match or If-None-Match header or entry etag attribute required

This is my code:

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);