首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用google-api-php-client库进行UserInfo服务身份验证

无法使用google-api-php-client库进行UserInfo服务身份验证
EN

Stack Overflow用户
提问于 2012-05-04 10:11:53
回答 1查看 696关注 0票数 0

我正在使用google-api-php-client库测试OAuth2服务,以便使用他们的Google帐户访问登录用户的UserInfo。代码取自examples/userinfo/index.php,稍加修改即可适应我的主机。在运行该示例时,它通过Google登录表单传递。当它返回到我的站点时,抛出一个异常,如下所示。

代码语言:javascript
复制
Fatal error:  Uncaught exception 'apiIOException' with message 'HTTP Error: (0) couldn't connect to host' in /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/io/apiCurlIO.php:120
Stack trace:
#0 /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/io/apiCurlIO.php(46): apiCurlIO->makeRequest(Object(apiHttpRequest))
#1 /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/io/apiREST.php(55): apiCurlIO->authenticatedRequest(Object(apiHttpRequest))
#2 /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/service/apiServiceResource.php(151): apiREST::execute(Object(apiServiceRequest))
#3 /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/contrib/apiPlusService.php(207): apiServiceResource->__call('get', Array)
#4 /home/ztbmwjhd/public_html/apis/at/googleplus/google-plus-access.php(40): PeopleServiceResource->get('me')
#5 /home/ztbmwjhd/public_html/apis/at/googleplus/index.php(2): include_once('/home/ztbmwjhd/...')
#6 {main}
  throw in /home/ztbmwjhd/public_html/apis/at/googleplus/google-api-php-client/src/io/apiCurlIO.php on line 120

谢谢你的帮助

EN

回答 1

Stack Overflow用户

发布于 2012-05-04 11:27:09

错误"HTTP Error:(0) host connect to host“通常表示您的服务器和google之间存在问题。您是否通过代理进行连接?

另外,尝试从命令行运行"curl https://www.googleapis.com/discovery/v1/apis“。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10441787

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档