package proposal: HTTP_SimpleClient
| From: | Alexey Borzov | Date: | Wed, 04 Jun 2003 12:15:37 +0000 |
| Subject: | package proposal: HTTP_SimpleClient | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-17000@lists.php.net to get a copy of this message | ||
Greetings!
The HTTP::SimpleClient class wraps around HTTP::Request and provides a higher level interface for performing HTTP requests:
$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();
Features:
* manages cookies and referrers between requests
* handles HTTP redirection
* ability to set default headers and request parameters
* implements the Subject-Observer design pattern: the base class sends events to listeners that do the response processing.
Source is available for review
http://158.250.10.119/pear/SimpleClient.phps
http://158.250.10.119/pear/CookieManager.phps
http://158.250.10.119/pear/Listener.phps
a usage example is available, too: a Listener implementation that does link checking with a script to use this
http://158.250.10.119/pear/LinkChecker.phps
http://158.250.10.119/pear/link-checker.phps