$pageValue = 'the string you want to write to the file, blah, blah..";
$fp=fopen('somefile.php','w');
$new = fwrite($fp,$pageValue);
fclose($fp);
if the write was successful, $new will = 1
You can also write a new file and ignore the warning typically like this:
$fp =@fopen('somefile.php','w');
Also I believe if you subsitute 'a' for 'w' you will APPEND the string to the end of the file, instead of writing the file over again.