Try this code
define ('DATA_FILE', 'c:\myfile.txt');
if (!file_exists(DATA_FILE))
{
die ('File not found: '.DATA_FILE);
}
$data = file_get_contents(DATA_FILE);
$replacementText = 'HERE GOES THE HEADER';
$data = preg_replace('/<head>(.*)<\/head>/msiU', $replacementText, $data);
$fd = fopen('w+', DATA_FILE);
fwrite($fd, $data);
fclose($fd);
Best of luck
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --