Parcourir la source

Update client.php

Maurits van der Schee il y a 7 ans
Parent
révision
1b3ff0de4a
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3
    3
      examples/client.php

+ 3
- 3
examples/client.php Voir le fichier

@@ -16,14 +16,14 @@ 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');
19
+$response = call('GET', 'http://localhost/api.php/posts?include=categories');
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 24
 
25
-$post = array('user_id'=>1,'category_id'=>1,'content'=>'from php');
26
-call('POST', 'http://localhost/api.php/posts',json_encode($post));
25
+$object = array('user_id'=>1,'category_id'=>1,'content'=>'from php');
26
+call('POST', 'http://localhost/api.php/posts',json_encode($object));
27 27
 
28 28
 ?>
29 29
 <html>

Loading…
Annuler
Enregistrer