Skip to content

Commit

Permalink
add example of Resty::postJson()
Browse files Browse the repository at this point in the history
  • Loading branch information
funkatron committed Feb 13, 2014
1 parent 4690173 commit 3ba18ec
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions example.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 3ba18ec

Please sign in to comment.