| changeset 47 | 267d67791e05 |
| 46:7e132e2a48ca | 47:267d67791e05 |
|---|---|
1 <?php |
|
2 header('Content-Type: application/json; charset=utf-8'); |
|
3 $file = "dynamic-data.json"; |
|
4 if (isset($_GET['reset']) && $_GET['reset']) { |
|
5 $resetfile = "test-data.json"; |
|
6 file_put_contents($file, file_get_contents($resetfile)); |
|
7 } |
|
8 if ($_SERVER['REQUEST_METHOD'] == 'PUT') { |
|
9 file_put_contents($file, file_get_contents("php://input")); |
|
10 echo json_encode(array("result" => "OK")); |
|
11 } else { |
|
12 echo file_get_contents($file); |
|
13 } |
|
14 ?> |