Hi,

I am trying to manipulate our domain user profile information.
I have successfully been able to retrieve profile information, but I
am having a hard time to edit that information...

The code for the editing of contacts follows:

<?php
  include "functions.php";

  checkLogin();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
  <body>
<?php

  // load Zend Gdata libraries
  require_once 'Zend/Loader.php';
  Zend_Loader::loadClass('Zend_Gdata');
  Zend_Loader::loadClass('Zend_Gdata_AuthSub');
  Zend_Loader::loadClass('Zend_Http_Client');
  Zend_Loader::loadClass('Zend_Gdata_Query');
  Zend_Loader::loadClass('Zend_Gdata_Feed');

  try {
    // perform login and set protocol version to 3.0
    $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['myToken']);
    $client->setHeaders('If-Match: *');

    $gdata = new Zend_Gdata($client);
    $gdata->setMajorProtocolVersion(3);

    $id = 'https://www.google.com/m8/feeds/profiles/domain/qadtest.com/
full/'.$_SESSION['uname'];

    // perform query and get result feed
    $query = new Zend_Gdata_Query($id);
    $entry = $gdata->getEntry($query);
    $xml = simplexml_load_string($entry->getXML());

    if($_GET['type'] == "e"){
      foreach($xml->email as $email){
        if($email['address'] == $_GET['value']){
          $email['address'] == $_GET['upd'];
        }
      }
    }else if($_GET['type'] == "p"){
      foreach($xml->phoneNumber as $phone){
        if($phone == $_GET['value']){
          $phone == $_GET['upd'];
        }
      }
    }

    /*echo $_GET['type']."<br>";
    echo $_GET['value']."<br>";
    echo $_GET['upd']."<br>";*/

    // update entry
    $entryResult = $gdata->updateEntry($xml->saveXML(),
      $entry->getEditLink()->href);/*

    echo 'Entry updated';

  }catch (Exception $e){
    die('ERROR:' . $e->getMessage());
  }
?>
  </body>
</html>

The values passed on the URL from the previous page are "type" ('e'
for email and 'p' for phone), "value" (the original value for that
field; could not find a key to lookup values... if someone knows a
better way...) and "upd" which is the updated value for that field.

I'm still trying to learn how to manipulate data using Google's API...
so the page is not near a finished state....

I'm getting this error: "ERROR:Expected response code 200, got 500 No
ETag attribute found on an update request"


Any ideas? Thanks in advance!

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to