client/data/simple-persist.php
author veltr
Fri, 27 Jul 2012 19:15:32 +0200
changeset 4 f5297dde9053
child 5 67085e6281e5
permissions -rw-r--r--
Can now add nodes/edges

<?php
    header('Content-Type: application/json; charset=utf-8');
    $file = "dynamic-data.json";
    if (isset($_GET['reset']) && $_GET['reset']) {
        $resetfile = "test-data.json";
        file_put_contents($file, file_get_contents($resetfile));
    }
    if ($_POST) {
        file_put_contents($file, json_encode($_POST));
        echo json_encode(array("result" => "OK"));
    } else {
        echo file_get_contents($file);
    }
?>