The code below almost works, but it\'s not what I really meant:
ob_start();
echo \'xxx\';
$contents = ob_get_contents();
ob_end_clean();
file_put_contents($f
here's a way to divert OUTPUT which appears to be the original problem
$ob_file = fopen('test.txt','w');
function ob_file_callback($buffer)
{
global $ob_file;
fwrite($ob_file,$buffer);
}
ob_start('ob_file_callback');
more info here:
http://my.opera.com/zomg/blog/2007/10/03/how-to-easily-redirect-php-output-to-a-file