繁体   English   中英

在php中获取Gmail联系人

[英]Fetch Gmail contacts in php

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

我使用下面的链接来获取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_idclient_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获得的回复?

请找到下面提到的步骤。

步骤1:

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

第2步:

在您的Google App中,您需要在授权重定向URL中添加http://localhost/contacts/index.php

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM