This is my first post on this site, so forgive me if I butcher it, but I'll try to be a clear and straight forwards as possible.
I'm trying to use the Google Contacts API to import the name and email address from an authenticated users gmail account. I am getting the email address fine using the generic code supplied by Google itself. I've tried to modify it to grab the contact names as well to no avail. Any help would be greatly appreciated. Below is the code I am currently using.
$xml = new SimpleXMLElement($val->getResponseBody());
$xml->registerXPathNamespace('gd', 'http://schemas.google.com/g/2005');
$result = $xml->xpath('//gd:email');
$name_result = $xml->xpath('//title');
foreach ($result as $title) {
echo "<div>".$title->attributes()->address."</div>";
}
foreach ($name_result as $name) {
echo "<div class='contact_alt'>".$name."</div>";
}