Cache/HTTP_Request.php
| From: | MARTY Fabien | Date: | Fri, 24 May 2002 09:26:07 +0000 |
| Subject: | Cache/HTTP_Request.php | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-6382@lists.php.net to get a copy of this message | ||
Hello,
I've written Cache/HTTP_Request.php.
--- Introduction ---
The classical example is :
You want to get news from another site through RSS remote files. But you
don't want to access to to the remote site at every time you display
its news on your site. Because, if the remote site is down or slow...
So you you need a class which makes a local cache copy of the remote file.
Every x hours, the cache is updated. But if the remote site is down, the
local cache copy is keeped (you can also get error messages if you want).
So you need this class !
Cache_HTTP_Request inherits from Cache and use HTTP_Request to access to
the remote file.
---- Usage example ---
<?php
require_once('Cache/HTTP_Request.php');
$cache = &new Cache_HTTP_Request("http://www.php.net", NULL, "file", NULL,
3600);
$cache->sendRequest();
$remoteFileBody = $cache->getResponseBody();
(...)
?>
--- Source ---
The source code is available at :
http://www.sousmarin.net/HTTP_Request.txt
--- So ? ---
So are you still interested in for PEAR ?
Questions or ideas are welcome !
Thanks,
Fabien