[OSM-dev] Code works on sandbox API, doesn't work on main API
Janos Rusiczki
kitsched-bot at clicktrackheart.com
Wed Dec 2 07:22:20 GMT 2009
I've posted this on the forum also (
http://forum.openstreetmap.org/viewtopic.php?id=5594 ) but figured I might
have better luck asking here.
---
Hello,
I wrote a small PHP script to import all the Romanian settlement boundaries
and it is working perfectly fine on api06.dev.openstreetmap.org. However
when I switched to api.openstreetmap.org I keep getting bad request errors.
Here's the code that creates a changeset.
$server = 'api.openstreetmap.org';
$put_file = fopen('tmp/tmpfile', 'w+');
fwrite($put_file, $create_changeset_data);
rewind($put_file);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://
'.$server.'/api/0.6/changeset/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $put_file);
curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$password);
$changeset_id = curl_exec($ch);
curl_close($ch);
fclose($put_file);
In $create_changeset_data I have the following:
<osm>
<changeset>
<tag k="created_by" v="Romanian Settlement Boundaries v0.1"/>
<tag k="comment" v="Boundaries for Bicaz / Source: Mircea Angelescu
(cultura.ro)"/>
</changeset>
</osm>
The provided user / password combination works and I can write tmp/tmpfile.
The error I'm getting (including headers) is here:
http://pastebin.com/m40669009
As I said, if I change $server to api06.dev.openstreetmap.org it works fine.
I don't get it, isn't the sandbox supposed to be exactly the same as the
main API? What's the use of it if it's not? :(
Regards,
Janos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20091202/d2ba1e21/attachment.html>
More information about the dev
mailing list