Update client.php

This commit is contained in:
Maurits van der Schee 2017-03-17 09:48:17 +01:00 committed by GitHub
commit 1b3ff0de4a

View file

@ -16,14 +16,14 @@ function call($method, $url, $data = false) {
return curl_exec($ch); return curl_exec($ch);
} }
$response = call('GET', 'http://localhost/api.php/posts'); $response = call('GET', 'http://localhost/api.php/posts?include=categories');
$jsonObject = json_decode($response, true); $jsonObject = json_decode($response, true);
$jsonObject = php_crud_api_transform($jsonObject); $jsonObject = php_crud_api_transform($jsonObject);
$output = json_encode($jsonObject, JSON_PRETTY_PRINT); $output = json_encode($jsonObject, JSON_PRETTY_PRINT);
$post = array('user_id'=>1,'category_id'=>1,'content'=>'from php'); $object = array('user_id'=>1,'category_id'=>1,'content'=>'from php');
call('POST', 'http://localhost/api.php/posts',json_encode($post)); call('POST', 'http://localhost/api.php/posts',json_encode($object));
?> ?>
<html> <html>