Hi, I have this code for requesting google to correct the typed in address, and need it to return the English name for the city:
function gmap_query_xml($in_address) {
$base_url = "http://maps.google.com/maps/geo?output=xml&region=US&language=en&key=". KEY;
$request_url = $base_url . "&q=" . urlencode($in_address);
return simplexml_load_file($request_url);
}
Then,
$xml = gmap_query_xml($in_address);
And finally to get the city name:
if ($xml) {
$city = (string) $xml->Response->Placemark->AddressDetails->Country->AdministrativeArea->SubAdministrativeArea->Locality->LocalityName;
}
This returns the correct city name, BUT! it's represented in the native language. Try Rome - you get Roma, try Kiev and you will get Киев.
How this can be solved? Thank!!