fread

(FW >= 1.0)

fread - Read data from a file, socket or input stream

Description

string fread( int $handle, int $length )

This will attempt to read $length bytes from the resource.  If less than the number of bytes are available it will return the data available.  If no data is available it will return a blank string.

Parameters

handle

Resource handle previous opened with fsockopen, fseropen, or fopen

length

Number of bytes to read

Return Value

fread() returns a string containing the data requested from the resource. If the call fails, it will return 0.

Examples

<? 
$fp = fopen("/index.cgi","r");
if (!$fp) {
     print("File open failed\n");
} else {
$data=fread($fp,250); // read 250 bytes from the file
print($data); fclose($fp); } ?>