Skip to content

Commit

Permalink
Improved signature
Browse files Browse the repository at this point in the history
  • Loading branch information
mevdschee committed Feb 17, 2017
1 parent a828d5c commit 7edb0a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/client_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

$cookiejar = tempnam(sys_get_temp_dir(), 'cookiejar-');

function call($method, $url, $data = false, $csrf = false) {
function call($method, $url, $csrf = false, $data = false) {
global $cookiejar;
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
Expand All @@ -27,8 +27,8 @@ function call($method, $url, $data = false, $csrf = false) {
}

// in case you are using php-api-auth:
$csrf = json_decode(call('POST','http://localhost/api.php/', 'username=admin&password=admin'));
$response = call('GET','http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1', false, $csrf);
$csrf = json_decode(call('POST','http://localhost/api.php/', false, 'username=admin&password=admin'));
$response = call('GET','http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1', $csrf);

unlink($cookiejar);

Expand Down

0 comments on commit 7edb0a2

Please sign in to comment.