Forum Moderators: coopster
I am trying generate a new PHP file from an existing page using PHP. Currently I'm using the output buffer to capture content destined for the page, and then am capturing that output and writing to a file.
The problem I am having is that all PHP scripts within the new page content are executed and the results are written to the new file, when I would like the PHP code itself to be written to the new file, unprocessed.
So now I am trying to just store the new page as a string and bypass the use of the output buffer, but do not know how to store php code within a string without having it execute.
For example, I'd like to write this string exactly as it is to a new file:
"
<html>
<body>
<? echo "from php";?>
</body>
</html>
"
But I'm getting this as the result:
"
<html>
<body>
from php
</body>
</html>
"
Hope that makes sense -- any help would be much appreciated.
-brian