I trying to dump all that was HTTP POST in json to a text file call logs.txt, the file can be written and
<?php
$myfile = fopen("/var/www/html2/inc/logs/logs.txt", "a") or die("Unable to open file!");
$data = json_decode($_POST, true);
fwrite($myfile, "\n".$data);
fclose($myfile);
?>
The result was actually empty.. nothing was written. I did try if the file is writeable and yes it created the file, no folder permission issue, I think of using serialize but its not working.