diff --git a/example.php b/example.php index 969669d..94178f9 100644 --- a/example.php +++ b/example.php @@ -18,3 +18,20 @@ echo "\n\$resp['body_raw']:\n"; var_dump($resp['body_raw']); + + +/** + * Resty::postJson() encodes the object or array as JSON and sends it as + * the request body. + */ +$to_json = array( + "foo"=>array( + "bar"=>"baz", + "bee"=>"bim", + "bop"=>23 + ) + ); +$resp = $resty->postJson('post', $to_json); + +echo "\n\$resp['body']->json:\n"; +var_dump($resp['body']->json);