Browse Source

add example for #211

Maurits van der Schee 8 years ago
parent
commit
c5627c4260
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      examples/client.php

+ 5
- 1
examples/client.php View File

@@ -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>

Loading…
Cancel
Save