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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
LonelyProgrammer
Forum Contributor
Posts: 108
Joined: Sun Oct 12, 2003 7:10 am

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

Post 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?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

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

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply