$KeepSearching = FALSE;
}
//try adding some text after the title tag
$myLine = eregi_replace("
"
//send line to browser
print("$myLine");
}
// send the rest of file to browser
fpassthru($myFile);
?>
integer fputs(int file_handle, string output)
The fputs function writes data to an open file. It expects a file handle as returned by
fopen, fsockopen, or popen. The number of bytes written is returned, or -1 when an
error occurs. The gzputs function performs the same task on compressed files.
<?
// open file for writing
$myFile = fopen("data.txt","w");
// make sure the open was successful
if(!($myFile))
{
print("file could not be opened");
exit;
}
for($index=0; $index<10; $index++)
{
// write a line to the file
fputs($myFile, "line $index\n");
}
// close the file
fclose($myFile);
?>
string fread(integer file_handle, integer length)
The fread function is a binary-safe version of the fgets function. That means it does not
pay attention to end-of-line characters. It will always return the number of bytes specified
by the length argument, unless it reaches the end of the file. This function is necessary if
you wish to read from binary files, such as jpeg image files.