Works on sandbox API, doesn't work on main API

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? :frowning:

The error I’m getting is here:
http://pastebin.com/m40669009

Content-Length: 47
Is 47 enough? The url itself is 53 and without the protocol specification 46. I’m a little bit out of this but should not Content-Length include the put content? It looks as if the file was not sent.

Error: Cannot parse valid Changeset from xml string .
Because nothing is received?

It now appears that kitsched posted this problem on the dev mailing list too:
http://lists.openstreetmap.org/pipermail/dev/2009-December/017835.html

And got it solved the same day.

So I could better have done something else yesterday.