Re: REMOTE FILE ?
| From: | Fabien MARTY | Date: | Thu, 23 May 2002 07:43:48 +0000 |
| Subject: | Re: REMOTE FILE ? | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-6352@lists.php.net to get a copy of this message | ||
>> (Remote File Class)
> I thought in a pear/Cache/Fopen.php class too. I had one samba partition
> mounted in my system but the netbios server is very busy so I decided to
> do local caching.
> +1 for it
So I can go for it ? I plan to make a pear/Cache/HTTP_Request which will inherit
of the Cache class and which will make an HTTP_Request object to access to the
given URL (and parameters : username, password...). The class will deal with the
cache system to implement the following features :
- when the local copy of the file is expired, the class will try to access to
the remote file and to make a local copy of it. If the remote server is down,
depending on the selected mode, the class will :
- keep and return the local copy
or
- return false
or
- return a PEAR_Error
(...)
Of course if the remote HTTP server is ok, the class will return the remote file
and will make a local copy of it.
I think at this synopsis :
<?php
require_once("Cache/HTTP_Request.php");
$remoteFile = new Cache_HTTP_Request("http://www.php.net",
$httpOptionnalParamaters, $cacheContainer, $cacheOptionnalParameters);
// (Of course, with default values for the three last arguments to make
// possible to call the constructor with only the URL parameter)
$body = $remoteFile->getResponseBody();
?>
So can i start to write code ? :-)
Thanks,
Fabien