Hi,
I get sometimes the following error message when i use the geonames webservice. When i reload the page its all ok.
Content-type of the website: text/html;charset=iso-8859-1
Code:
Error Message:
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML'
in mysite.php:71 Stack trace: #0
mysite.php(71): SimpleXMLElement->__construct('') #1 {main}
thrown in mysite.php on line 71
Line 71: $urlinhalt=@file_get_contents($adresse);
Code:
$adresse="http://ws.geonames.org/postalCodeSearch?postalcode=".rawurlencode(utf8_encode(trim($_POST["plz"])))."&country=".$country."&maxRows=1";
$urlinhalt=@file_get_contents($adresse);
$urlinhalt = $urlinhalt;
$xml = @new SimpleXMLElement($urlinhalt);
$anzahl=$xml->totalResultsCount;
$land_kuerzel=$xml->code->countryCode;
$bundesland=utf8_decode($xml->code->adminName1);
$gemeinde=utf8_decode($xml->code->adminName2);
$longitude=$xml->code->lng;
$latitude=$xml->code->lat;
HELP please
THANK YOU!
Max