Hello,
I wrote a small PHP script to import all the Romanian settlement boundaries and it was working fine on api06.dev.openstreetmap.org. However when I switched the to api.openstreetmap.org I keep getting bad request errors.
Here’s the code that creates a changeset. It works fine on the sandbox but doesn’t on the main API:
$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.
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?