Forum Moderators: coopster

Message Too Old, No Replies

end of file cut off

         

bleak26

10:54 pm on Mar 27, 2005 (gmt 0)

10+ Year Member



I am attempting to read in a file and output it again, but the outputted file is returned with out the end of the file.
I have varied the amount of data read in using fread by adjusting the argument and it seems to make no difference, could it be that the string variables in PHP are to small to accommodate the whole page?

?php
// choose stock to look at
$symbol='AMZN';

$theurl='www.asite.com/apage.htm';

if (!($fp = fopen($theurl, 'r')))
{
echo 'Could not open URL';
exit;
}
$contents = fread($fp, 1000000);
fclose($fp);


echo $contents;
?>

wrightee

11:29 pm on Mar 27, 2005 (gmt 0)

10+ Year Member



Yes; but the limit is pretty big. You could just output a line at a time for what you're doing with that code perhaps?