-1

When I tested the google-vision-api, it showed below every time :

 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

I followed the step on this page, and my code is just the example in google.

I'm in China now, but I have been using a VPN. It helps a lot if anybody can figure it out.

ɢʀᴜɴᴛ
  • 32,025
  • 15
  • 116
  • 110
Gosling
  • 21
  • 5
  • 2
    If you look up the error code, as the message already advised you to, you find this error described as "CURLE_COULDNT_CONNECT (7) - Failed to connect() to host or proxy." - so there is some sort of connectivity issue. _“I'm in China now”_ - well that’s likely part of it ... – CBroe Sep 05 '17 at 08:22
  • Thanks for replying!But I can visit any google page with terminal and browser.It makes me feel uncertain whether it is because I'm in China. – Gosling Sep 05 '17 at 08:47
  • Well maybe it’s not because of that, but some other reason ... but you’ll probably have to talk to the person in charge of the server andor network configuration to find out ... – CBroe Sep 05 '17 at 08:49
  • I run it on my personal Macbook.All available means have been tried.Still I can't figure it out. – Gosling Sep 05 '17 at 09:05

1 Answers1

0

I have figured this out.The OS Server can't access the VPN. This is what it's introduction says:It is a separately sold operating system add-on which provides additional server programs along with management and administration tools for macOS. So I changed to use MAMP to replace it to set up a Apache server on my Mac.It works for me.

Gosling
  • 21
  • 5