In this case we are talking about an entire page, so to do this you would have to compose the entire page in string assignments, and you lose the nice embedded feature of php.
i.e.
instead of saying
<table>
<tr>
<td>Name</td>
<td><? echo $name ?></td>
</tr>
</table>
you would have to say
$page = '<table>
<tr>
<td>Name</td>
<td>'.$name.'</td>
</tr>
</table>';
...and you would have to do that for the entire page. Creating a string like this also means that is you have includes() you want to use, those will have to be converted as well.
Of course it can be done this way, it would just be much easier of you could redirect SDTOUT. There is a method for doing this in Perl..