File size: 445 Bytes
7dc9c15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
 $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,
    )
 ));