hello,
check out the php manual for the fopen() function..
Also check out Writing PHP - 7: Reading and writing files over at www.codehelp.co.uk
here is a snippet of code
<?
// read temp.php, write tempinclude=1,
// then insert temp.php into final outputfile
// note: not for use on very small, single line files -
// use fgetc() instead
$maxread=filesize("temp.php");
if (!($fout=fopen($outputfile,"w"))) die ("Cannot create output file.");
fwrite($fout,"<?php\n$tempinclude=1;\n?>");
if (!($fp=fopen("temp.php","r"))) die ("Cannot open temporary file.");
$data = fgets($fp,$maxread);
while ((ftell($fp)<$maxread)) {
fwrite($fout,$data);
$data = fgets($fp,$maxread);
}
fclose($fp);
fclose($fout);
?
hope this helps,
- Justin