equal
deleted
inserted
replaced
3 $file = "dynamic-data.json"; |
3 $file = "dynamic-data.json"; |
4 if (isset($_GET['reset']) && $_GET['reset']) { |
4 if (isset($_GET['reset']) && $_GET['reset']) { |
5 $resetfile = "test-data.json"; |
5 $resetfile = "test-data.json"; |
6 file_put_contents($file, file_get_contents($resetfile)); |
6 file_put_contents($file, file_get_contents($resetfile)); |
7 } |
7 } |
8 if (isset($_POST['data'])) { |
8 if ($_SERVER['REQUEST_METHOD'] == 'PUT') { |
9 file_put_contents($file, $_POST['data']); |
9 file_put_contents($file, file_get_contents("php://input")); |
10 echo json_encode(array("result" => "OK")); |
10 echo json_encode(array("result" => "OK")); |
11 } else { |
11 } else { |
12 echo file_get_contents($file); |
12 echo file_get_contents($file); |
13 } |
13 } |
14 ?> |
14 ?> |