diff --git a/classes/adonis.php b/classes/adonis.php index f65140b..fb07ab1 100644 --- a/classes/adonis.php +++ b/classes/adonis.php @@ -50,23 +50,26 @@ class Adonis { curl_setopt($req, CURLOPT_HTTPHEADER, $headers); curl_setopt($req, CURLOPT_POST, true); curl_setopt($req, CURLOPT_POSTFIELDS, $req_data); + curl_setopt($req, CURLOPT_RETURNTRANSFER, true); $res_raw = curl_exec($req); curl_close($req); - $res = json_decode($res_raw); + $res = json_decode($res_raw, true); if ($extract_response == true) { $res = $res[$endpoint . "Result"]; } - if ($res["Authentication_Approved"] != true) { + if ($res["Authentication_Approved"] != 1) { throw new AdonisAuthenticationDeniedException(); } if ($res["ErrorText"]) { throw new AdonisException($res["ErrorText"]); } + + return $res; } function getToken($api) { @@ -156,4 +159,4 @@ class Adonis { return $requirements; } -} \ No newline at end of file +}