Re: output of fread() is blank

From: Date: Mon, 27 Jan 2003 23:41:07 +0000
Subject: Re: output of fread() is blank
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133315@lists.php.net to get a copy of this message
Hello, The PHP manual page for filesize (http://www.php.net/manual/en/function.filesize.php) mentions that it will not work on remote files. fread will stop once n number of bytes are read or EOF is received so you could set this to the maximum file size (in bytes) that you want to download. Jason On Mon, 2003-01-27 at 16:27, Guru Geek wrote: > 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 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#133315) next »