Search code examples
phpgoogle-apihttp-request

HTTP Error failed


I'm using a Google PHP SDK to do uploads for my clients in their google Drive using the Google APIs Console. Sometimes I get this error: HTTP Error: (0) Failed to connect to 2607:f8b0:4002:c06::5f: Network is unreachable

Anybody know how to resolve it?


Solution

  • Your client network can't resolve an IPV6 address. So it can't open the socket for send the HTTP request.

    You can force IPV4 with

    curl_setopt( $handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);