At 04:22 11.03.2003, Anthony Ritter said:
--------------------[snip]--------------------
>I'm trying to test the following script to display the contents of the
>following URL but it will not output.
>
>Any advice will be greatly appreciated.
>Thank you.
>Tony Ritter
>.......................................................
>
><? $file_handler = fopen("http://www.weather.com", "r"); $contents =
>fread($file_handler, filesize($file)); fclose($file_handler); echo
>$contents; ?>
--------------------[snip]--------------------
You cannot stat() (i.e. use filesize()) a remote file, filesize() will
return false making your script read 0 (zero) bytes.
When reading remote files you may consider chunking them:
$fh = fopen('http://www.weather.com', 'r');
if ($fh) {
while ($chunk = fread($fh, 4096))
echo $chunk;
fclose($fh);
}
This will work perfectly (if url-fopen-wrapper is enabled in your build
anyway).
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php