avantman42
(Russ Phillips)
August 3, 2009, 4:55pm
#1
I’m trying to change an existing node using a PHP script. My simple test script (which will, if it works, add the “addr:street” key) is as follows:
<pre>
<?php
$data = "<?xml version='1.0' encoding='UTF-8'?>\n";
$data .= "<osm version='0.6' generator='avantman42-php'>\n";
$data .= "<changeset>\n";
$data .= "<node id='408368412' lat='48.13213250462367' lon='11.543279671866909'>\n";
$data .= "<tag k='name' v='Kebab Range'/>\n";
$data .= "<tag k='amenity' v='fast_food'/>\n";
$data .= "<tag k='cuisine' v='kebab'/>\n";
$data .= "<tag k='addr:street' v='Ford Green Road'/>\n";
$data .= "</node>\n";
$data .= "</changeset>\n";
$data .= "</osm>\n";
$url = "http://www.openstreetmap.org/api/0.6/node/408368412";
$r = http_put_data ($url, $data, array ("httpauth"=>"user:password"));
print_r ($r);
?>
</pre>
It returns the following:
HTTP/1.1 500 Internal Server Error
X-Runtime: 12
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Content-Length: 51
Error: NameError: uninitialized constant OSM::BadUserInput
Date: Mon, 03 Aug 2009 16:54:49 GMT
Server: lighttpd/1.4.22
NameError: uninitialized constant OSM::BadUserInput
Can anyone tell me what I’m doing wrong? I suspect the XML is wrong, but I can’t work out what is wrong with it.
Russ
MHohmann
(Manuel)
August 3, 2009, 7:40pm
#2
The XML code you send to the server does not contain a version number, as specified in the API . I’m not sure whether that’s the only error source…
IMHO the OSM server should output a different error code (4xx) in such situations - it looks like a server problem when generating this error code…
avantman42
(Russ Phillips)
August 3, 2009, 7:45pm
#3
I found the API page you linked to just as you posted your reply. I had been using the HTTP_Protocol_Specification page as a reference, and changing mention of 0.3 or 0.4 to 0.6
I think I might be able to get somewhere now. Thanks.
Russ