You are here: Re: [PHP] POST method to php page from php page « PHP « IT news, forums, messages
Re: [PHP] POST method to php page from php page

Posted by Philip Hallstrom on 04/08/05 19:08

> Hello all
>
> Does anyone know if its possible to post data using the http POST method to
> another form using php?

Yes. If you search around you'll find some pure-PHP code snippets to do
this... or do it yourself...

To programmatically make a POST request you need to open a socket
connection to the web server on port 80 and
send the following information:

--------------------------------------------------------------------------
POST /path/to/form.php HTTP/1.1
Host: www.somehost.com
Content-type: application/x-www-form-urlencoded
Content-length: 71
Connection: close

xxxxxxxx=urlencoded_xxxxxxx_data&yyyyyyyyyyy=urlencoded_yyyyyyyyyy_data
--------------------------------------------------------------------------

Each line is terminated by a single newline (\n).

Content-length is simply the length of the data being sent (the last line
in this case).

You'll need to urlencode the data in order to transport it safely. See
this for more info on what this does: http://us3.php.net/urlencode. Only
encode the actual data though... that is the stuff after the equal sign.

Then you'll need to read back the response headers and do whatever you
want from there...

 

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

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