$open = fopen ("yourtextfile.txt", "r");
$contents = fread ($open, filesize ("yourtextfile.txt"));
fclose ($open);
$yourcontents = $newstufftoadd . $contents;
$open = fopen ("yourtextfile.txt", "w+");
fwrite ($open, $yourcontents);
fclose ($open);
Open the file, read all the old in, prepend the new stuff, write the file back out.