Re: fread bug? + how to read in a http:// file

From: Date: Wed, 05 Jul 2000 14:27:21 +0000
Subject: Re: fread bug? + how to read in a http:// file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4950@lists.php.net to get a copy of this message
At 04:17 PM 7/5/00 +0200, you wrote: >$fp=fopen("http://anywhere.org/some/stuff.php","r"); >$con=fread($fp,$con_len); >fclose($fp); >what do i write for $con_len? This is really an issue for the manual, what you are trying to do there is VERY bad practice. You don't read in all the content at once, you read it in chunks, the second parameter for fread is the maximum ammount to read, and you do all your reading in a loop that checks whether or not you've reached the end of the file. while ( !feof($fp) ) { $str = fread($fp, 4096); echo $str; } ... etc..

« previous php.general (#4950) next »