sf-9a1 / generate.php
kemsa51's picture
Add 4 files
7dc9c15 verified
raw
history blame contribute delete
445 Bytes
<?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,
)
));