| $data = json_decode(file_get_contents('php://input'), true); | |
| $title = $data['title']; | |
| $author = $data['author']; | |
| $story = $data['story']; | |
| $id = uniqid(); | |
| // Create the story file | |
| file_put_contents("stories/". $id .".json", $story); | |
| // Return the story id | |
| echo json_encode(array( | |
| "status" => "ok", | |
| "data" => array( | |
| "id" => $id, | |
| "title" => $title, | |
| "author" => $author, | |
| "story" => $story, | |
| ) | |
| )); |