- Executing the API Call from PHP was NOT working
- API Key was setup correctly
- Curl or WGET from Windows is working correctly
- Get from the browser is working ok
- WGET/CURL from the command line on CentOS 7 was NOT working ok.
HEre is the output from when I did WGET for the Google Maps API Call:
Resolving maps.googleapis.com (maps.googleapis.com)... 2607:f8b0:4000:816::200a, 216.58.194.106, 216.58.194.138, ...
Connecting to maps.googleapis.com (maps.googleapis.com)|2607:f8b0:4000:816::200a|:443... failed: Connection timed out.
Connecting to maps.googleapis.com (maps.googleapis.com)|216.58.194.106|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
I could tell it was using IPv6 and the request was timing out. After much Googling I found that others were having the same issue and the resolution was to not use IPv6 for the call. I disabled IPv6 on the machine in question and then the API call worked just fine.
Thank to the following Unixmen Article: https://www.unixmen.com/disable-ipv6-centos-7/
Moving forward,
- I need to make sure that IPV6 is not disabled globally for the entire machine. Would be nice if it wasn't.
- Add this to some checklist somewhere that when I need to use the Google Maps API, I check for this
Full disclosure, I had this working fine on a different CentOS 7 machine and had forgotten how I fixed it for the first 1 hour of research. Then I remembered that it was an "Iptables or Firewall problem". Nope. Then after another hour of research and comparing output on the 2 machines I realized it was due to IPv6. Then I decided to blog about it because I knew I had blogged about it before, but apparently really only thought of blogging about it. Duh!
I hope I can find this blog the next time I need it. :)