Reputation: 135
I used google api to fetch contacts of google account. The code that I used is http://code.google.com/p/google-api-php-client/source/browse/trunk/examples/contacts/simple.php
But when I run the code by applying my credential, it gives me the contacts but just their name. I want the contacts email address.
Upvotes: 1
Views: 489
Reputation: 51
You can find how to fetch emails on this link, the problem was on the example code. This is part of the code refered in the link.
$req = new \apiHttpRequest("https://www.google.com/m8/feeds/contacts/default/full?max-results=9999");
$val = $client->getIo()->authenticatedRequest($req);
$xml = new \SimpleXMLElement($val->getResponseBody());
$xml->registerXPathNamespace('gd', 'http://schemas.google.com/g/2005');
$result = $xml->xpath('//gd:email');
foreach($result as $title)
{
$emails[] = $title->attributes()->address;
}
Upvotes: 0
Reputation: 5809
refer this.
Google Authentication API Library with PHP for User Details
Upvotes: 0
Reputation: 2921
I always use this to fetch gmail contacts
.
http://contactsimporter.com/address-book-importer-demo.html
Hope you will like this too.
It authenticates
the user on our own end, doesn't send user to authenticate to gmail.
Just give it a try.
Here's the download link.
http://svetlozar.net/downloads/import.zip
Upvotes: 1