Fixes
This commit is contained in:
parent
f5014fa180
commit
5539640080
|
@ -50,23 +50,26 @@ class Adonis {
|
||||||
curl_setopt($req, CURLOPT_HTTPHEADER, $headers);
|
curl_setopt($req, CURLOPT_HTTPHEADER, $headers);
|
||||||
curl_setopt($req, CURLOPT_POST, true);
|
curl_setopt($req, CURLOPT_POST, true);
|
||||||
curl_setopt($req, CURLOPT_POSTFIELDS, $req_data);
|
curl_setopt($req, CURLOPT_POSTFIELDS, $req_data);
|
||||||
|
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
$res_raw = curl_exec($req);
|
$res_raw = curl_exec($req);
|
||||||
curl_close($req);
|
curl_close($req);
|
||||||
|
|
||||||
$res = json_decode($res_raw);
|
$res = json_decode($res_raw, true);
|
||||||
|
|
||||||
if ($extract_response == true) {
|
if ($extract_response == true) {
|
||||||
$res = $res[$endpoint . "Result"];
|
$res = $res[$endpoint . "Result"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($res["Authentication_Approved"] != true) {
|
if ($res["Authentication_Approved"] != 1) {
|
||||||
throw new AdonisAuthenticationDeniedException();
|
throw new AdonisAuthenticationDeniedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($res["ErrorText"]) {
|
if ($res["ErrorText"]) {
|
||||||
throw new AdonisException($res["ErrorText"]);
|
throw new AdonisException($res["ErrorText"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getToken($api) {
|
function getToken($api) {
|
||||||
|
|
Loading…
Reference in a new issue