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] [EMAIL PROTECTED]

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

Reply via email to