Page 1 of 1

How do I store the output of a HTML rendered text into file?

Posted: Thu Mar 27, 2008 9:10 am
by LonelyProgrammer
Hi,

I am doing a log file, and would like to record the content of my forms each time it is processed, for testing purposes (it's PayPal's IPN, btw).

Is there anyway to store the output of this code:

Code: Select all

echo"<pre>";
print_r($_POST);
echo "</pre>";
Into a variable or a file?

Re: How do I store the output of a HTML rendered text into file?

Posted: Thu Mar 27, 2008 9:54 am
by pickle
You could use output buffering, or better - pass the little known second argument to print_r() to just have it return the result rather than displaying it.

If you're writing to a text file, and will be viewing it as a text file, there's no need for the <pre> tags - print_r() will already display fine as plain text.