I am using Google GeoCoding services. I have a PHP application which calls the Google Maps API, and receives JSON data. The function which calls Google Maps host hangs until it times out, but only when I push to Godaddy Virtual Private server.
I have already ssh'd into the server and edited php.ini I changed "safe mode" to "off"
I get this error message:
Message: file_get_contents(http://maps.googleapis.com/maps/api/geocode/json?address=xYxY&sensor=false): failed to open stream: Connection timed out
This works fine in my WAMP server but fails on live server. Any ideas why?
I have found the answer. What has been a week, now? I hope others find this solution. The virtual dedicated servers from GoDaddy are ipv6 enabled, but google maps API is having none of that. So tell Curl to force v4 request, like this:
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
credit is due in part to a blog where I found this information:
http://www.businesscorner.co.uk/disable-ipv6-in-curl-and-php/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With