|
@@ -16,11 +16,15 @@ function call($method, $url, $data = false) {
|
16
|
16
|
return curl_exec($ch);
|
17
|
17
|
}
|
18
|
18
|
|
19
|
|
-$response = call('GET', 'http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1');
|
|
19
|
+$response = call('GET', 'http://localhost/api.php/posts');
|
20
|
20
|
$jsonObject = json_decode($response, true);
|
21
|
21
|
|
22
|
22
|
$jsonObject = php_crud_api_transform($jsonObject);
|
23
|
23
|
$output = json_encode($jsonObject, JSON_PRETTY_PRINT);
|
|
24
|
+
|
|
25
|
+$post = array('user_id'=>1,'category_id'=>1,'content'=>'from php');
|
|
26
|
+call('POST', 'http://localhost/api.php/posts',json_encode($post));
|
|
27
|
+
|
24
|
28
|
?>
|
25
|
29
|
<html>
|
26
|
30
|
<head>
|