我正在使用google-api-php-client库测试OAuth2服务,以便使用他们的Google帐户访问登录用户的UserInfo。代码取自examples/userinfo/index.php,稍加修改即可适应我的主机。在运行该示例时,它通过Google登录表单传递。当它返回到我的站点时,抛出一个异常,如下所示。
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谢谢你的帮助
发布于 2012-05-04 11:27:09
错误"HTTP Error:(0) host connect to host“通常表示您的服务器和google之间存在问题。您是否通过代理进行连接?
另外,尝试从命令行运行"curl https://www.googleapis.com/discovery/v1/apis“。
https://stackoverflow.com/questions/10441787
复制相似问题