Hi forum members.
I am struggling with a weird case of different responses when looking at the XML returned from openstreetmaps API in FireFox versus requesting the same resource using cURL and PHP.
CASE:
Try opening the URL in e.g. FireFox address bar:
http://nominatim.openstreetmap.org/search?format=xml&polygon=0&q=Albrechtice&countrycodes=CZ
You will see that “place” node number 4 (out of 9) from the top is looking like this:
Pay close attention to the place_id, osm_id, latitude/longitude and boundingbox information.
Now; try requesting the same url programmatically:
<?php $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "[http://nominatim.openstreetmap.org/search?format=xml&polygon=0&q=Albrechtice&countrycodes=CZ](http://nominatim.openstreetmap.org/search?format=xml&polygon=0&q=Albrechtice&countrycodes=CZ)" ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_TIMEOUT, 40 ); $result = curl_exec( $ch ); $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; $doc->formatOutput = true; $doc->loadXML( $result ); $doc->save( "external_xml_saved.xml" ); ?>Open the saved XML file. Place “node” number 4 (out of 9) now has totally different OSM data:
Can someone please explain to me why there is a difference?
Many thanks for helping out,
Kevin