[thelist] POST data with PHP

sbeam sbeam at syxyz.net
Thu Aug 12 06:16:24 CDT 2004


On Thursday 12 August 2004 05:15 am, Kasimir K wrote:
> Richard Livsey wrote on 12/08/2004 4:52:
> > A tricky one this, and I'm not sure if it is at all possible, but
> > here goes.
> >
> > 1. I have a form which points to a PHP script.
> > 2. When the script receives the POST data, it validates it.
> > 3. If the data doesnt validate, a page is displayed with details.
> > 4. If the data validates, then the POST data wants to be sent on to
> > another page which may not be on the same server.
> >
> > Is step 4 possible?
>
> I haven't done this myself, but it should be possible. Below is a
> function I use to make GET requests, it's fairly easy to change it
> for POST's.

Not tricky at all. This wheel has already been invented:
http://pear.php.net/package/HTTP_Client/
specifically the post() method (aptly named!) might be of interest:
http://pear.php.net/manual/en/package.http.http-client.http-client.post.php

you could even upload a file or send cookies.

Any web scripting language worth its salt has should have a way to send 
all types of HTTP requests without muddling around in the actual 
sockets.

enjoy.

-- 

# S Beam - Web App Dev Servs
# http://www.onsetcorps.net/


More information about the thelist mailing list