Re: Help with fread()

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: Help with fread()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-171166@lists.php.net to get a copy of this message
Why not just fread($pagehandle,32768) ? On Wed, 26 Nov 2003, Nick Wilson wrote: > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#171166) next »