Help with fread()
| From: | Nick Wilson | Date: | Wed, 26 Nov 2003 17:41:22 +0000 |
| Subject: | Help with fread() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-171107@lists.php.net to get a copy of this message | ||
Hi all,
I'm using the code below to open webpages and read them into a variable.
I got the example from the manual but am confused as to how to limit how
much of the page to read.
Ideally, I just want to read the first 30k of each webpage. Could
somebody please show me how?
$pagehandle=@fopen($pagebeingcrawled,"rb");
$contents = "";
do {
$data = @fread($pagehandle, 8192);
if (strlen($data) == 0) {
break;
}
$contents.=$data;
while(true);
@fclose($pagehandle);
Many thanks!
--
Nick W