What manual are you reading?
There are not 3 parameters to [man]fgets[/man].
Coping from example #1 on [man]fgets[/man]
<?php
$handle = @fopen("/tmp/inputfile.txt", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>
You could do something like
<?php
$handle = @fopen("./oldfile.php", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
if($buffer == '<tag>'){
// do something
}
}
fclose($handle);
}
?>
Also, using fopen to open a .php file is generally not a good idea. Use .dat or .txt files.