master
Matt Huntington 8 years ago
parent 7adff9649a
commit 5b644e2ff5

@ -3,3 +3,5 @@ RewriteCond %{REQUEST_METHOD} ^DELETE$
RewriteRule ^([0-9]+)$ delete.php?id=$1 RewriteRule ^([0-9]+)$ delete.php?id=$1
RewriteCond %{REQUEST_METHOD} ^POST$ RewriteCond %{REQUEST_METHOD} ^POST$
RewriteRule ^$ post.php RewriteRule ^$ post.php
RewriteCond %{REQUEST_METHOD} ^PUT$
RewriteRule ^([0-9]+)$ update.php?id=$1

@ -0,0 +1,12 @@
<?php
header('Content-Type: application/json');
include 'data/people.php';
$requestBody = file_get_contents('php://input');
$body = json_decode($requestBody);
$zagthar = new Person($body->name, $body->age);
$people[$_REQUEST['id']] = $zagthar;
echo json_encode($people);
?>
Loading…
Cancel
Save