Hi Noah, You seem to be just copying a file, if so use this instead:
http://www.php.net/manual/en/function.copy.php Or try to describe what you're trying to do and what the you see as a problem. Both fread() and fwrite(0 don't interpret the PHP code in files that they are reading and writing. Greetings, Jaap At 2003-06-10 15:32 -0700, CF High wrote: >Hey all. > >Interesting problem here, at least for me ;--): > >How to generate php pages using fopen() without having php code evaluated in >the written pages? > >For example, if build_pages.php runs a db query and, based on the result >set, produces a test page using fopen(), how to avoid having php code >getting evaluated? > >Here's an example snippet: > >********************************************************************* > // Set read & write paths > $write_path = "C:\\apache\\htdocs\\client_site\\files\\"; > $write_path = $write_path . "example_page.php"; > $read_path = $doc_path . "build_pages.php"; > > // Read file to variable & close > $fr = fopen($read_path, "r") or die("An error occurred while opening >$read_path"); > $text = ""; > while (!feof($fr)){ $text .= fread($fr, 100000); } > fclose($fr); > > // Create example page > $fw = fopen($write_path, "wb") or die("An error occurred while opening >$write_path"); > > // Write data to example page >$make_page = fwrite($fw, $text); > > fclose($fw); >********************************************************************* > >Give a holler for more info -- I know the question is a little vague -- I'm >still figuring out how to implement this solution.......... > >--Noah > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php