I have a php page that requests reverse geocoding data from Nominatim OSM server. It was working for over a year. Recently started blocking my requests with the following message:
You have been temporarily blocked because you have been overusing OSM's geocoding service or because you have not provided sufficient identification of your application. This block will be automatically lifted after a while. Please take the time and adapt your scripts to reduce the number of requests and make sure that you send a valid UserAgent or Referer.
I am sure that i am not exceeding the quota (1 request / second), because my code is still in pre-production. i might have 1 request / hour on a busy day.
Below a sample of php testing code. I used to get what i needed on line 6 $xml =...
, which is now blank / not xml data (so i scrape the page and get the error message):
$latLast = 52.5487429714954;
$lngLast = -1.81602098644987;
$feedUrl = "http://nominatim.openstreetmap.org/reverse?format=xml&lat=".$latLast."&lon=".$lngLast;
$rawFeed = file_get_contents($feedUrl);
try { // nominatim server blocking this ip, must change solution
$xml = new SimpleXmlElement($rawFeed);
print_r($xml);
} catch (Exception $e) {
echo $e->getMessage()."</br>second attempt:</br>";
try {
$html = file_get_html($url);
echo "HTML2: [$html]</br>";
} catch (Exception $e) {
echo $e->getMessage()."</br>";
}
}
How do i send a "valid UserAgent or Referer"? How do i provide "sufficient identification"?