Search code examples
bashgoogle-mapscurlgoogle-geocodergoogle-geocoding-api

Google Geocode api always returns ZERO_RESULTS using CURL


I am trying to use CURL in a bash script to get JSON from Google Geocode, but I can't get it to work with --data-urlencode or --data

this will return ZERO_RESULTS:

curl -k --data "address=berlin&sensor=false" http://maps.googleapis.com/maps/api/geocode/json

however this is successful:

curl http://maps.googleapis.com/maps/api/geocode/json?address=berlin&sensor=false

What am I doing wrong here?


Solution

  • It appears to work when I include -G.

    curl -G -k --data "address=berlin&sensor=false" http://maps.googleapis.com/maps/api/geocode/json