Re: Package idea: HTTP::SimpleClient

From: Date: Mon, 17 Mar 2003 09:18:29 +0000
Subject: Re: Package idea: HTTP::SimpleClient
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14352@lists.php.net to get a copy of this message
17 Март 2003 11:58, Martin Jansen написал: > On Sun Mar 16, 2003 at 02:4357PM +0300, Alexey Borzov wrote: > > The HTTP::SimpleClient class should probably have the following > > functionality: > > > > head($url) - perform a HEAD request on $url > > get($url, $params) - perform a GET request on $url, optionally adding > > $params to it (consider a <form method="get">) > > post($url, $params) - perform a POST request on $url > > Can you explain what the difference between HTTP::SimpeClient and > HTTP_Request, HTTP_Post, HTTP_Header is? HTTP::SimpleClient will wrap around HTTP::Request. While the latter represents a single request, the former will make it easier to perform multiple ones. Consider: 1) Authenticate to a web application, receive a session cookie; 2) Submit a first form of a multiform wizard; ... N) Submit an Nth form of a multiform wizard; N+1) Check the resultant page for a success token ("Thank you!") or a failure token ("You didn't fill in the 'bar' field!"). And this will automagically take care of cookies and referers and will have an easier interface to 'submitting' forms: $client =& new HTTP_SimpleClient(); $client->post($url, array('login' => $login, 'password' => $password)); instead of $request =& new HTTP_Request($url); $request->setMethod(HTTP_REQUEST_METHOD_POST); $request->addPostData('login', $login); $request->addPostData('password', $password); $request->sendRequest(); HTTP::Post duplicates the functionality of HTTP::Request and was probably accepted just because its author's name is not 'Alexey Borzov'. ;] HTTP::Header is not a HTTP client package, but rather a HTTP server one, that deals with sending headers via Header() builtin function. I'll probably post a link to some prototype of HTTP_SimpleClient today or tomorrow.

« previous php.pear.dev (#14352) next »