在php中获取Gmail联系人

Ami*_*shi 6 php google-contacts-api google-content-api

我想获得与给定的Gmail帐户相关联的电子邮件ID.这应该在我正在使用的本地服务器xampp server上完成Windows 7.

我使用下面的链接来获取Gmail联系人.

https://www.design19.org/blog/import-google-contacts-with-php-or-javascript-using-google-contacts-api-and-oauth-2-0/

我已经完成了以下步骤:

  1. 在谷歌上创建项目,并激活联系人api.

  2. 粘贴client_id和client_secret_id.

  3. google_redirect_uri ='http://localhost';

问题

当我点击import google contacts按钮时,它会将我重定向到谷歌的登录页面选择一个登录帐户,登录后网站要求我Allow Contact shares这样做?"

点击允许按钮后,它会将我重定向到xampp的默认索引页面,http://localhost/dashboard/因为在我设置的谷歌应用程序的重定向网址中http://localhost.

我尝试将重定向网址设置为根据我的文件程序路径联系谷歌的api,但它不允许我使用/所以我将其设置为:http://localhost代替http://localhost/contacts/index.php

那么在哪里可以看到我从谷歌联系api获得的回复?

Shy*_*iya 5

请找到下面提到的步骤.

步骤1:

在localhost应用程序中,您需要将重定向URL设置为 http://localhost/contacts/index.php

第2步:

在你的谷歌应用程序,你需要添加http://localhost/contacts/index.php在授权各重定向URL.

更改此设置后,您就可以在特定页面上重定向.

确保您在localhost客户端调用中的重定向URL和在Google App中都需要相同,否则您将面临错误.

如果它不起作用,请告诉我.