|
Posted by M. Sokolewicz on 04/08/05 13:23
Aurélien Cabezon wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bob Pilly wrote:
> | Hello all
>
> Hi,
>
> | Does anyone know if its possible to post data using the http POST method
> | to another form using php?
> | I know its possible to use:
> | header( "Location: somelocation.php?" .SID&somevar=$somevar );
> | But this uses the GET method
> | any help or pointing me to any relevant documentation would be greatly
> | appreciated.
>
> You can use Curl to post datas to a remote script.
> http://www.php.net/curl
>
> Regards,
> Aurélien
also, I think Bob is a tad confused about what header does exactly.
Because header() adds lines to the RESPONSE-header, not the
REQUEST-header. The REQUEST header can send its request as a
GET/POST/PUT/whatever, while the response header doesn't do anything
even remotely like that. Basically, the 'Location'-response-header tells
the browser that the file can be found at a different location, so the
browser redirects there automatically. This is *not* a GET! Since you've
added your query to the URL and browsers, by default, use the GET method
of requesting data, the URL the browser will redirect to will be
requested with the GET method, so it might seem asif you were using GET
to request the page, for the browser, but in truth you don't have
anything to day about it.
Now, what Aurélien is talking about, cURL, is the other end of the
story. cURL can take on the role of both ends of the line, so it can
send either the request, or the response. But, it will not send it to
the user('s browser), but instead over a connection that it was told to
send it over.
Basically, this means that you can't tell a browser it needs to do a
POST request to another page via PHP. There :)
hope that helps you in understanding,
- tul
[Back to original message]
|