[OSM-dev] Code works on sandbox API, doesn't work on main API
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.
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+');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://
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);
In $create_changeset_data I have the following:
<tag k="created_by" v="Romanian Settlement Boundaries v0.1"/>
<tag k="comment" v="Boundaries for Bicaz / Source: Mircea Angelescu
The provided user / password combination works and I can write tmp/tmpfile.
The error I'm getting (including headers) is here:
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? :(
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dev