Script Sample:
wget -qO- "http://maps.google.com/maps/geo?q=台中市中山路1號&output=csv"
Output:
200,8,24.1371957,120.6842909
(3rd column is latitude, 4th is longitude)
PHP Sample:
$ch = curl_init();
$address="台中市中山路1號";
curl_setopt($ch, CURLOPT_URL, "http://maps.google.com/maps/geo?q=$address&output=csv");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output=explode(',',curl_exec($ch));
curl_close($ch);
echo "Latitude: $output[2]
Longitude: $output[3]
";
Output:
Latitude: 24.1371957
Longitude: 120.6842909