2010-06-07 27 views
1

Salut les gars J'essaie de mettre à jour mes contacts google en utilisant le framework zend mais je 'M obtenir l'erreur suivante:"If-Match ou If-None-Match en-tête ou attribut etag attribut requis" Erreur lors de la tentative de mise à jour d'un contact sur google contacts en utilisant Zend Framework

Expected response code 200, got 403 If-Match or If-None-Match header or entry etag attribute required 

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

Que se passe-t-il?

Répondre

1

i a obtenu une solution dans http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14476692

est ici le message de ce lien:

// in listing 6... // somewhere before the updateEntry call add: $extra_header = array(); $extra_header='*';

// and then replace the current updateEntry call with the following: $entryResult = $gdata->updateEntry($xml->saveXML(),$entry->getEditLink()->href,null,$extra_header);

Updates to Google Contacts now work.

je reçois travailler pour mon code. encore une fois il y a un problème avec le code dans le message. qui est

$extra_header = array(); 

$extra_header = array('If-Match'=>'*'); 

$entryResult = $contactObj->updateEntry($xml->saveXML(),$entry->getEditLink()->href,null,$extra_header); 

Je pense qu'il vous aidera à résoudre le problème de la mise à jour aussi bien.

grâce