You are here: Re: Trying to submit multipart/form-data HTTP POST using PHP script « PHP Programming Language « IT news, forums, messages
Re: Trying to submit multipart/form-data HTTP POST using PHP script

Posted by Rik on 01/16/07 19:43

Boldgeek wrote:
> 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?

As my crystal ball is broken, I cannot see what is wrong with either the
request you send, or with the PHP code that builds it. If you really want
to know what's wrong, post an example of the request that breaks (offcourse
strip out the actual file-data, and possibily security stuff), not the
request that's OK :-)

What I can advise you though, is perhaps to use curl instead of fsockopen
if you have it available. It saves a lot of handcoding requests.
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация