Let\'s assume I have the following file - template.php:
template.php
This should do it:
ob_start(); include('template.php'); $returned = ob_get_contents(); ob_end_clean();
If you don't need to do this within PHP, you could execute a php script from the command line, and pipe it to a text file, like so:
php -f phpFile.php > output.html