从谷歌获取联系人


Fetch Contacts from google

我使用google api获取google帐户的联系人。我使用的代码是http://code.google.com/p/google-api-php-client/source/browse/trunk/examples/contacts/simple.php

但是当我通过应用我的凭据运行代码时,它给了我联系人,但只是他们的名字。我想要联系人的电子邮件地址

我总是这样对fetch gmail contacts

http://contactsimporter.com/address-book-importer-demo.html

希望你也会喜欢。

如果authenticates用户在我们自己的端,不发送用户身份验证到gmail。

试一试。

这是下载链接。

http://svetlozar.net/downloads/import.zip

参考此。

Google Authentication API Library with PHP for User Details

http://www.technew.in/forum_thread_621_Google-Authentication-API-Library-with-PHP-for-User-Details.html

您可以在此链接上找到如何获取电子邮件,问题在示例代码上。这是链接中引用的代码的一部分。

    $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;
    }