Google Analytics API V3 - HTTP Error: Unable to connect on live server (localhost works fine)

后端 未结 1 1319
伪装坚强ぢ
伪装坚强ぢ 2020-12-22 09:17

(I am using the latest version of this library: https://github.com/google/google-api-php-client)

In short, my script works perfectly on localhost, but whenever I upl

相关标签:
1条回答
  • 2020-12-22 09:39

    To debug further you can go to the API client library at /src/Google/IO/Stream.php and look for the line that is

    throw new Google_IO_Exception("HTTP Error: Unable to connect");
    

    You can append messages on to that... like this 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 any solution, you may want to follow 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 as well but I have not figured out a solution. I got Cloud Storage working by removing the gzip CONST at the top of the Stream.php, but Drive still does not work and I am thinking this all has to be related.

    EDIT: Take a look at the issue I linked, basically you should try to set gzip to disabled in the Config.php - this fixed the issues for me.

    I found this issue had to do with differing PHP versions between my localhost and my server

    I submitted a new issue here: https://github.com/google/google-api-php-client/issues/78

    0 讨论(0)
提交回复
热议问题