$inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $display = $input->winner . ">" . $input->loser; $data = $input->winner . ">" . $input->loser . ","; echo "
The following ordering was recorded:
"; echo "$display
"; $filename = "rankings.txt"; $myfile = fopen($filename, "a"); if (!$myfile) { die("Unable to open $filename."); } fwrite($myfile, $data); fclose($myfile); ?>