output of fread() is blank
| From: | Guru Geek | Date: | Mon, 27 Jan 2003 23:27:08 +0000 |
| Subject: | output of fread() is blank | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-133313@lists.php.net to get a copy of this message | ||
Hello,
I'm a recent convert from CGI/Perl and so am still getting my feet wet
in PHP.
Here's my code:
$filename = "http://www.myserver.com/include/sometext.txt";
$handle = fopen ($filename, "rb");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
echo $contents;
exit;
The problem is nothing shows up, it's a blank browser window. I'm sure
this is a stupid questions and very easily fixed.
Also, if the text file I'm trying to read is multi lined, shouldnt I be
placing the contents into an array? or is that old cgi habits coming
through?
Thanks,
Roger