title: Modifing gmail contact php Oauth
body: <p>I am trying to modify a contact but doesn't work. The <code>$idg</code> value contain the contact info in the way: <code>ht*t*p://www.google.com/m8/feeds/contacts/xxxxx%40gmail.com/base/yyyyyyyyyyyy</code></p>
  
  <p>To include a new contact is working calling: <code>h*t*tp://www.google.com/m8/feeds/contacts/xxxxx%40gmail.com/full</code> and using a <code>$add-&gt;setRequestMethod("POST");</code>
  but I am not able to modify a contact.</p>
  
  <pre><code>session_start();
  $user_email = 'xxxxx%40gmail.com';
  
  $client = new Google_Client();
  $client-&gt;setApplicationName("Google Apps PHP Starter Application");
  $client-&gt;setScopes(array(
       'https://www.google.com/m8/feeds/',
       'https://www.google.com/m8/feeds/user/',
  ));
  
  
  $client-&gt;setApplicationName('Pepe');
   $client-&gt;setClientId('jjjjjj.apps.googleusercontent.com');
  $client-&gt;setClientSecret('jjjjjjjj');
  $client-&gt;setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
  $client-&gt;setAccessToken(file_get_contents('refreshtoken.conf'));
  
      $contact="
      &lt;atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
          xmlns:gd='http://schemas.google.com/g/2005'
          xmlns:gContact='http://schemas.google.com/contact/2008'&gt;
         &lt;atom:category scheme='http://schemas.google.com/g/2005#kind'
          term='http://schemas.google.com/contact/2008#contact'/&gt;
        &lt;gd:name&gt;
       &lt;gd:givenName&gt;".utf8_decode($nom)."&lt;/gd:givenName&gt;
       &lt;gd:familyName&gt;".utf8_decode($ape)."&lt;/gd:familyName&gt;
       &lt;gd:fullName&gt;".utf8_decode($nom)." ".utf8_decode($ape)."&lt;/gd:fullName&gt;
    &lt;/gd:name&gt;
    &lt;atom:content type='text'&gt;Notes&lt;/atom:content&gt;
    &lt;gd:email rel='http://schemas.google.com/g/2005#home'
      primary='true'
      address='".$ema."' displayName='".utf8_decode($nom)." ".utf8_decode($ape)."'/&gt;
    &lt;gd:phoneNumber rel='http://schemas.google.com/g/2005#mobile'
      primary='true'&gt;
      ".$tel."
    &lt;/gd:phoneNumber&gt;
    &lt;gd:structuredPostalAddress
        rel='http://schemas.google.com/g/2005#home'
        primary='true'&gt;
      &lt;gd:city&gt;".$ciu."&lt;/gd:city&gt;
      &lt;gd:street&gt;".$dir." ".$num." ".$pue."&lt;/gd:street&gt;
      &lt;gd:region&gt;&lt;/gd:region&gt;
      &lt;gd:postcode&gt;&lt;/gd:postcode&gt;
      &lt;gd:country&gt;Spain&lt;/gd:country&gt;
      &lt;gd:formattedAddress&gt;
        ".$dir." ".$num." ".$pue." ".$ciu."
      &lt;/gd:formattedAddress&gt;
    &lt;/gd:structuredPostalAddress&gt;
    &lt;gContact:userDefinedField key='Codigo' value='".$cod."'/&gt;
    &lt;gContact:userDefinedField key='Doctor' value='".$doct."'/&gt;
    &lt;gContact:userDefinedField key='Especialista' value='".$espe."'/&gt;
   &lt;gContact:groupMembershipInfo deleted='false'
          href='http://www.google.com/m8/feeds/groups/".$user_email."/base/6'/&gt;
   &lt;gContact:groupMembershipInfo deleted='false'
          href='http://www.google.com/m8/feeds/groups/".$user_email."/base/3adf49fe0beabbb2'/&gt;
  &lt;/atom:entry&gt;
  ";
  
  
  $len = strlen($contact);
  $add = new Google_Http_Request("".$idg."");
  
  $add-&gt;setRequestMethod("PUT");
  $add-&gt;setPostBody($contact);
  
  $add-&gt;setRequestHeaders(array('content-length' =&gt; $len, 'GData-Version'=&gt; '3.0','content-type'=&gt;'application/atom+xml; charset=UTF-8; type=feed'));
  
  $submit = $client-&gt;getAuth()-&gt;authenticatedRequest($add);
  $sub_response = $submit-&gt;getResponseBody();
  
  $parsed = simplexml_load_string($sub_response); 
  $client_id = explode("base/",$parsed-&gt;id);
  $idgoogle = $parsed-&gt;id;
  echo 'The ID of the new entry is: ' . $parsed-&gt;id;
  echo 'Por ahora es '.  $submit;
    echo 'Entry updated';
   } catch (Exception $e) {
      die('ERROR:' . $e-&gt;getMessage());
    }
    }
  </code></pre>