-2

我必须在我的项目中使用 google api 使用 php 项目:使用 google 搜索引擎并收集 url 及其源页面

我下载了 google api php 客户端,然后我按照这里写的内容 https://code.google.com/p/google-api-php-client/

运行后我得到这个错误:

致命错误:未捕获的异常“Google_ServiceException”与消息“调用 GET https://www.googleapis.com/plus/v1/people/me/activities/public?key=[已编辑]:(403)访问未配置”中的错误C:\xampp\htdocs\google-api-php-client\src\io\Google_REST.php:66 堆栈跟踪:#0 C:\xampp\htdocs\google-api-php-client\src\io\Google_REST。 php(36): Google_REST::decodeHttpResponse(Object(Google_HttpRequest)) #1 C:\xampp\htdocs\google-api-php-client\src\service\Google_ServiceResource.php(186): Google_REST::execute(Object( Google_HttpRequest)) #2 C:\xampp\htdocs\google-api-php-client\src\contrib\Google_PlusService.php(58): Google_ServiceResource->__call('list', Array) #3 C:\xampp\htdocs \googleapitest.php(31): Google_ActivitiesServiceResource->listActivities('me', 'public') #4 {main} 在 C 中抛出:\xampp\htdocs\google-api-php-client\src\io\Google_REST.php 在第 66 行

我完全糊涂了,不知道该怎么办

4

2 回答 2

0

该错误通常意味着您不符合 API 控制台中的访问要求 - 即,如果您配置了 IP 或引荐来源网址限制。

于 2013-09-15T00:54:24.350 回答
0

只需删除您的开发人员密钥并添加范围

'www.googleapis.com/auth/userinfo.email',
'www.googleapis.com/auth/userinfo.profile', 
'www.googleapis.com/auth/plus.login',
'www.googleapis.com/auth/plus.me'));
于 2015-06-13T05:50:57.113 回答