I'm saving JSON string (using javascript's JSON.stringify) via Ajax call to a php script that write this string into a file i.e.
<?php
$msg = $_GET['hecdata'];
if (strlen($msg) > 0)
{
$file = fopen("hecdata.txt","w");
fwrite($file,$msg);
fclose($file);
echo "True";
}
else
{
echo "False";
}
?>
but the problem is the format of JSON become:
[{\"customerName\":\"Customer 1\",\"contactNumber\":\"03001234567\",\"hallName\":\"4\",\"bookingDate\":\"09/30/2013\"}]
which is not correct, I am new to php, is this how we should save a json string into a text file?