Hi Ravi,
Since the Zend_Gdata library doesn't have support for the Contacts API
yet, you'll need to manually extract the contents of the gd:email tag:
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full');
$feed = $gdata->getFeed($query);
foreach ($feed as $entry) {
// Get contact name
if ($entry->title != "") {
echo $entry->title;
} else {
echo "(Untitled Contact)";
}
// Get all email addresses associated with the contact
echo "<ul>\n";
$emails = $entry->getExtensionElements('gd:email');
foreach ($emails as $email) {
$attributes = $email->getExtensionAttributes();
if (array_key_exists('address', $attributes)) {
echo "<li>" . $attributes['address']['value'] . "</li>\n";
}
}
echo "</ul>\n";
}
--
Trevor Johns
Ravi,
There was an error in the code I just sent. Use this instead:
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full');
$feed = $gdata->getFeed($query);
foreach ($feed as $entry) {
// Get contact name
if ($entry->title != "") {
echo $entry->title;
} else {
echo "(Untitled Contact)";
}
// Get all email addresses associated with the contact
echo "<ul>\n";
$extensionElements = $entry->getExtensionElements();
foreach ($extensionElements as $extensionElement) {
if ($extensionElement->rootNamespaceURI ==
"http://schemas.google.com/g/2005"
&& $extensionElement->rootElement == "email") {
$attributes = $extensionElement->getExtensionAttributes();
--
Trevor Johns