Skip to content

Commit 3ba18ec

Browse files
committed
add example of Resty::postJson()
1 parent 4690173 commit 3ba18ec

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

example.php

+17
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,20 @@
1818

1919
echo "\n\$resp['body_raw']:\n";
2020
var_dump($resp['body_raw']);
21+
22+
23+
/**
24+
* Resty::postJson() encodes the object or array as JSON and sends it as
25+
* the request body.
26+
*/
27+
$to_json = array(
28+
"foo"=>array(
29+
"bar"=>"baz",
30+
"bee"=>"bim",
31+
"bop"=>23
32+
)
33+
);
34+
$resp = $resty->postJson('post', $to_json);
35+
36+
echo "\n\$resp['body']->json:\n";
37+
var_dump($resp['body']->json);

0 commit comments

Comments
 (0)