For further debugging, you can go to the client API library at /src/Google/IO/Stream.php and find the line
throw new Google_IO_Exception("HTTP Error: Unable to connect");
You can add messages to this ... for example, to get the http error code
throw new Google_IO_Exception("HTTP Error: Unable to connect " . $this->getHttpResponseCode($http_response_header));
Let me know if you come up with a solution, you can go on this issue: https://github.com/google/google-api-php-client/issues/75 . My code works fine on my localhost, but not on my dev server, but I did not find a solution. I got Cloud Storage working by deleting gzip CONST at the top of Stream.php, but Drive still does not work, and I think it should all be connected.
EDIT: take a look at the problem I'm related to, basically you should try disabling gzip in Config.php - this fixed the problems for me.
I found that this problem is related to different versions of PHP between my localhost and my server.
Here I introduced a new number: https://github.com/google/google-api-php-client/issues/78
source share