[eluser]a.somervell[/eluser]
'nother question for the group:
Code:
$url = "http://maps.google.com/maps/geo?output=xml&key=ABQIAAAAnbn99sEqA=".str_replace(" ","+", preg_replace("/[^a-zA-Z0-9 ]/", "", preg_replace('/\s\s+/'," ", $address)));
try {
$kml = new SimpleXMLElement( file_get_contents($url, "r"));
} catch (Exception $e) {
//Do something exceptional...
}
If $address is say... "143" then the google XML will come back with a ridiculously long number of addresses, not idea but thats fine, I just go "found more than one address, please be more specific" to the user.
Problem is all the Japanese, Czech and other weird characters that come through that makes SimpleXMLElement go:
Code:
SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xFD 0x3C 0x2F 0x41
I figure I have to run the response through some sort of character translation function between getting the contents and passing it to SimpleXMLElement... But I cant figure out what that should be...?