|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-06-06 16:59 UTC] john dot winstanley at angelsolutions dot co dot uk
I'd like to be able to process a client request on one page and then pass that request along with information to another page using POST.
At the moment all I can do is forward the request by using GET and the header("Location: someurl?attribute=4"); function.
Thanks Guys
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 08:00:01 2025 UTC |
Thanks for directing me to the curl extension it will be really helpfull but The advantage of PHP over all other scripting languages is its ease of use. This is the code needed to do a simple post request using curl. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"hello.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "postvar1=value1&postvar2=value2&postvar3=value3"); curl_exec ($ch); curl_close ($ch); Too long too difficult to understand all the steps for the average user. We can make it easier as below but I'd like a function in the php core like this postrequest($url,$parameters); function postrequest($url,$parameters) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url) curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters); curl_exec ($ch); curl_close ($ch); } This would encourage PHP developers to use Java MVC like archutechture where a request can be processed on one page and then forwarded to another with a requestDispatcher or post request. Communication between different pages is currently one of PHPs big weaknesses where it loses out to servlets. Make curl part of the core and use simplfied functions to make it really easy to use!!