...
Code Block | ||||
---|---|---|---|---|
| ||||
<?php $headers = array("content-type:application/json"); $shelterbuddyUrl = "https://mysite.shelterbuddy.com"; $username = urlencode("my@username"); $password = urlencode("myS3ecureP@ssw@rd"); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $shelterbuddyUrl . sprintf("/api/v2/authenticate?username=%s&password=%s", $username, $password)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); $authToken = json_decode($result); array_push($headers, sprintf("sb-auth-token:%s", $authToken)); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $shelterbuddyUrl . sprintf("/api/v2/animal/list?PageSize=%s", 1)); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "{ }"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); $result = json_decode($result); var_dump($result); ?> |
...