$inputJSON = file_get_contents('php://input'); $item = json_decode($inputJSON); $n = count($item); $filename = "items.txt"; $myfile = fopen($filename, "a"); if (!$myfile) { die("Unable to open $filename."); } echo "
The following items were recorded:
"; echo "