Reading from remote file
| From: | Daniele Baroncelli | Date: | Sun, 06 Jul 2003 12:05:12 +0000 |
| Subject: | Reading from remote file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-154117@lists.php.net to get a copy of this message | ||
Hi guys,
I am trying to read from a remote file, by using an example reported at the
manual page for the fread function:
<?php
$handle = fopen ("http://www.php.net/",
"rb");
$contents = "";
do {
$data = fread ($handle, filesize ($filename));
if (strlen($data) == 0) {
break;
}
$contents .= $data;
}
fclose ($handle);
?>
Unfortunately this example is incorrect, as it gives me a parse error. The
mistake should be in the fact that there is a "do" keyword without a
"while".
Would anyone suggest me the correct version?
Cheers
Daniele