This commit is contained in:
Kumi 2022-11-28 07:29:26 +00:00
parent f5014fa180
commit 5539640080
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -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) {
@ -156,4 +159,4 @@ class Adonis {
return $requirements; return $requirements;
} }
} }