简体   繁体   English

Google API PHP客户端无法获取联系人

[英]Google API PHP Client cannot get contacts

I used the code like line 49 to line 54 of this https://code.google.com/p/google-api-php-client/source/browse/trunk/examples/contacts/simple.php But, I got the invalid_grant error. 我使用了类似于https://code.google.com/p/google-api-php-client/source/browse/trunk/examples/contacts/simple.php的第49行到第54行的代码,但是invalid_grant错误。 I went to Google APIs Console, I cannot file Google Contacts service to grant. 我进入了Google API控制台,我无法提交要授予的Google通讯录服务。

Please help me. 请帮我。

Did you include the proper settings on the following lines? 您是否在以下几行中包含了正确的设置? You will need to create the appliation settings at the API Console and then plug those settings into your code below. 您需要在API控制台中创建应用程序设置,然后将这些设置插入下面的代码中。 This code worked perfect for me once all the settings were correct. 一旦所有设置正确,此代码对我来说就是完美的。

$client = new Google_Client();
$client->setApplicationName('Google Contacts PHP Sample');
$client->setScopes("http://www.google.com/m8/feeds/");
// Documentation: http://code.google.com/apis/gdata/docs/2.0/basics.html
// Visit https://code.google.com/apis/console?api=contacts to generate your
// oauth2_client_id, oauth2_client_secret, and register your oauth2_redirect_uri.
// $client->setClientId('insert_your_oauth2_client_id');
// $client->setClientSecret('insert_your_oauth2_client_secret');
// $client->setRedirectUri('insert_your_redirect_uri');
// $client->setDeveloperKey('insert_your_developer_key');

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

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