为什么我无法使用 PHP 访问 google-cloud-vision api?

Why I can't access the google-cloud-vision apis with PHP?

当我测试google-vision-api时,它每次都显示如下:

 Fatal error: Uncaught exception
 'Google\Cloud\Core\Exception\ServiceException' with message 'cURL
 error 7: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in
 /Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-core/RequestWrapper.php:245
 Stack trace: #0
 /Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-core/RequestWrapper.php(150):
 Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(Google\Cloud\Core\Exception\ServiceException))
 #1 /Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-core/RestTrait.php(96):
 Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request),
 Array) #2
 /Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-vision/Connection/Rest.php(59):
 Google\Cloud\Vision\Connection\Rest->send('images', 'annotate', Array)
 #3 /Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-vision/VisionClient.php(269):
 Google\Cloud\Vision\Connection\Rest->annotate(Array) #4
 /Library/Server/Web/Data/Sites/local in
 /Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-core/RequestWrapper.php
 on line 245

我按照这个page的步骤,我的代码就是google中的例子。

我现在在中国,但是一直在用VPN。如果有人能弄明白,那将有很大帮助。

我发现这个out.The OS服务器无法访问VPN。 这就是它的介绍 says:It 是一个单独出售的操作系统插件,它提供了额外的服务器程序以及 macOS 的管理和管理工具。 所以我改用 MAMP 来代替它在我的 Mac.It works for me 上设置 Apache 服务器。