Re: Package Proposal: HTTP_Download
| From: | Stefan Walk | Date: | Mon, 05 May 2003 14:21:31 +0000 |
| Subject: | Re: Package Proposal: HTTP_Download | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-15891@lists.php.net to get a copy of this message | ||
On Mon, May 05, 2003 at 08:59:56AM -0500, Paul M Jones wrote:
> How about some examples or quick text/HTML docs? Looks neat, but I am
> not sure from the code how one is to use it.
>
>
> _______________________________________________________________________
>
> Paul M. Jones
> pjones@ciaweb.net
> http://ciaweb.net
Example:
$dl = new HTTP_Download('http://sourcehost.com/sourcefile',
'/path/to/target.file');
<?php
$status = $dl->init();
if (PEAR::isError($status)) {
// handle error
}
// now, we have two ways to continue... either
while($dl->transferChunk($size)) {
// watcher code
}
// or:
$dl->transferComplete($chunksize, $callback);
// with the callback beign called for every chunk that gets transferred
?>
Regards, Stefan Walk