无法使用带有google api php客户端库的UserInfo服务进行身份验证

无法使用带有google api php客户端库的UserInfo服务进行身份验证,php,google-api,Php,Google Api,我正在使用GoogleAPI php客户端库测试OAuth2服务,以使用登录用户的google帐户访问用户信息。代码取自examples/userinfo/index.php,对我的主机几乎没有改动。运行该示例时,它通过Google登录表单。当它返回到我的站点时,抛出一个异常,如下所示 Fatal error: Uncaught exception 'apiIOException' with message 'HTTP Error: (0) couldn't connect to host'

我正在使用GoogleAPI php客户端库测试OAuth2服务,以使用登录用户的google帐户访问用户信息。代码取自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
感谢您的帮助

错误“HTTP错误:(0)无法连接到主机”通常意味着您的服务器和google之间存在问题。您是否通过代理进行连接


另外,尝试从命令行运行“curl”。

谢谢Chirag,我不使用代理。似乎“curl-googleapis.com/oauth2/v1/userinfo?access_-token=”不起作用您遇到了什么类型的错误?您可以尝试使用“curl-vURL”来获取更详细的日志记录吗?