Saturday, March 11, 2017

Fetch contacts email address in Laravel

I am learning how to view gmail contacts and following this tutorial. https://mydnic.be/post/how-to-get-all-gmail-contacts-with-laravel-5

As per the article below code fetches the contacts.

Url = 'https://www.google.com/m8/feeds/contacts/default/full?alt=json&max-results=400';
$result = json_decode($googleService->request(Url), true);
$emails = []; // initialize the new array
foreach ($result['feed']['entry'] as $contact) {
    if (isset($contact['gd$email'])) { // Sometimes, a contact doesn't have email address
        $emails[] = $contact['gd$email'][0]['address'];
    }
}

Here the problem is, it shows me even those email addresses to whom I sent emails. is there url that picks only contacts?



via Pankaj

Advertisement