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

Reply via email to