hm, first:
you can use the file() function instead of fopen - fread - fclose, that's more comfortable. it reads the entire text file into an array, one line per element. for example:
$data = file("data.txt");
foreach($data as $line)
echo trim($line)."<br>\n";
as for the refresh, I would suggest doing it via the html meta commands.