我正在使用 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
谢谢您的帮助