#24070 [Bgs->Opn]: Use post instead of get for header("Location:")

From: Date: Fri, 13 Jun 2003 14:47:40 +0000
Subject: #24070 [Bgs->Opn]: Use post instead of get for header("Location:")
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-41857@lists.php.net to get a copy of this message
ID: 24070 User updated by: john dot winstanley at angelsolutions dot co dot uk Reported By: john dot winstanley at angelsolutions dot co dot uk -Status: Bogus +Status: Open Bug Type: Feature/Change Request Operating System: Any PHP Version: 4.3.2 New Comment: 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!! Previous Comments: ------------------------------------------------------------------------ [2003-06-06 18:34:09] sniper@php.net There is the curl extension already which you should use for that. ------------------------------------------------------------------------ [2003-06-06 16:59:49] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24070&edit=1

« previous php.bugs (#41857) next »