client/data/simple-persist.php
author ymh <ymh.work@gmail.com>
Wed, 09 Apr 2014 17:28:44 +0200
changeset 272 c87698c8cde6
parent 248 cdfa6479982b
permissions -rw-r--r--
correct oejw.WebSocketConnectionRFC6455:Text message too large > 65520 chars bug

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