From 62ffa48f55a9a5846220e5b156887d5c5f5a46f6 Mon Sep 17 00:00:00 2001 From: Galileon-venta <48894231+Galileon-venta@users.noreply.github.com> Date: Thu, 12 Nov 2020 11:00:36 +0100 Subject: [PATCH] changed get random feedback; now contains Count of Feedbacks requested --- src/ventAPI.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ventAPI.php b/src/ventAPI.php index 5946ab7..464cc19 100644 --- a/src/ventAPI.php +++ b/src/ventAPI.php @@ -1,12 +1,16 @@ file_get_contents_secure($url), true); + return json_decode($this->get_secure($url)); } - public function ventAPI_get_random_feedback(){ - $url = "http://ventaGaming.de:9090/api/secure/web/getFeedback/random"; - return json_decode($this->file_get_contents_secure($url)); + public function ventAPI_get_random_feedback($count){ + $url = "http://ventaGaming.de:9090/api/secure/web/getFeedback/random/".$count.""; + return json_decode($this->get_secure($url)); } public function ventAPI_login($username,$password){ @@ -42,7 +46,11 @@ public function ventAPI_login($username,$password){ $_SESSION['ventAPItoken'] = $response->getBody(); } - private function file_get_contents_secure($url){ + private function get_secure($url){ + if(!isset($_SESSION['ventAPItoken'])){ + echo ('Not logged in for Secure Action'); + return []; + } return $this->http->request('GET',$url,[ 'headers' => [ 'AUTHORIZATION' => 'Bearer '.$_SESSION['ventAPItoken'],