Update client.php
This commit is contained in:
parent
c5627c4260
commit
1b3ff0de4a
1 changed files with 3 additions and 3 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue