Hi
I am trying to output some data to a file which is fine. The data is set as a variable $data as follows:-
$data ="{ <br />
"method":"dad_data",<br />
"ver":"1.2",<br />
"dad_id":"RKDAD__02323",<br />
"data":[<br />
{"id":"324344445","period":"2011-05-18T08:30","value":".$v1."},<br />
{"id":"354555542","period":"2011-05-18T08:30","value":".$v2."}<br />
]<br />
}";
If a simple echo is used then the " and line breaks are shown but when the output is sent to a file it shows <br /> and ".
Simple question is how do I get " and a line break in the output file?
This is the code I am using to produce the output file.
$ob_file = fopen('test.json','w');
function ob_file_callback($buffer)
{
global $ob_file;
fwrite($ob_file,$buffer);
}
$ob_file = fopen('test.json','w');
ob_start('ob_file_callback');
// Output now will go to test.txt
echo $data;
ob_end_flush();
Any help much appreciated.
Thanks