lets do it a bit different... same way, but he forgot a few things.
#First lets define the path to the file we want to write, or append to.
$filename = "file.txt";
#lets first create a file pointer, pointing to what we need, first param of fp() is the filename, the second is the mode.. mode, "a+", "r+", "w+", and such. (a for append, r for read, and w for write)
$filePointer = fp($filename, "a+");
#Now lets open it, first parameter of fopen() is the filePointer we just created, and the second parameter is the the amount of data extracting.
#You can read more about that at php.net searching for fread();
#We use "filesize($filename)" so we get the whole file...
$fileContents = fopen($filePointer, filesize($filename));
#now we go aheaed and close the file...
fclose($filepointer);
#Now you can echo out the contents, or just do whatever..
echo $fileContents;
Hope this helps... Alot of notes in there hehehe, read them!! Its important!