Trying to submit multipart/form-data HTTP POST using PHP script

I am trying to develop an app that will allow automatic updating of a
web form which uses multipart/form-data enctype (as it MIGHT be sending
an image)

I have an example form, which when submitted displays the results as
you would expect.
However when I send the same data using the PHP script I get a 400
error:

Bad Request
Your browser sent a request that this server could not understand.
Request header field is missing colon separator.
( it then displays the boundary string.)

After examining the HTTP headers for the submitted form, it appears
EXACTLY the same as the post I make via the PHP script. I've tried
copying EVERYTHING exactly and it still comes up with the error.

If I remove the actual content, ie end the request like:

Content-Type: multipart/form-data;
boundary=---------------------------265001916915724
Content-Length: 0

It works fine. However as soon as we start adding boundary strings and
form parts, I get the error. Everything is formatted correctly. I can
provide examples if required.

I'm using fsockopen in the PHP script to connect to the target server &
page

I'm at my wits end trying to see what is wrong with the PHP script -
anyone got any ideas?
Thanks in advance...
Boldgeek [ Di, 16 Januar 2007 11:14 ] [ ID #1597294 ]

Re: Trying to submit multipart/form-data HTTP POST using PHP script

Please don't multipost. Crosspost if you really, really need different
newsgroups.
Answered in comp.lang.php
--
Rik Wasmus
Rik [ Di, 16 Januar 2007 21:10 ] [ ID #1597326 ]

Re: Trying to submit multipart/form-data HTTP POST using PHP script

Rik wrote:

> Please don't multipost. Crosspost if you really, really need different
> newsgroups.
> Answered in comp.lang.php
> --
> Rik Wasmus

My appologies, usenet noob here...
Boldgeek [ Di, 16 Januar 2007 22:53 ] [ ID #1597347 ]
PHP » alt.php » Trying to submit multipart/form-data HTTP POST using PHP script

Vorheriges Thema: Best PHP IDE for Windows
Nächstes Thema: strtotime and a very mysterious date