5) { $uri = substr($uri, 0, $pos); } $pieces = explode('/', $uri); $psc = count($pieces); $endpoint = $psc > 0 ? $pieces[$psc - 1] : ''; log_message('critical', "Enpoint-> ".$endpoint ); $endpoints = [ 'apigate' => ['POST'], 'generics' => ['POST'], 'createuser' => ['POST'], 'createmobileuser' => ['POST'], 'completemobileuser' => ['POST'], 'startresetpasword' => ['POST'], 'userlogin' => ['POST'], 'startjoblist' => ['POST'], 'dashdata' => ['POST'], 'getjobsdata' => ['POST'], 'offerslist' => ['POST'], 'activejoblist' => ['POST'], 'loadprofile' => ['POST'], 'account' => ['POST'], 'message' => ['POST'], 'pendingjob' => ['POST'], 'paymenthx' => ['POST'], 'getjob' => ['POST'], 'mybanklist' => ['POST'], 'sendmoney' => ['POST'], 'sendinterest' => ['POST'], 'sendmoneyfee' => ['POST'], 'getpendingjobs' => ['POST'], 'taskmessage' => ['POST'], 'sendtaskmessage' => ['POST'], 'getwallets' => ['POST'], 'sitecontact' => ['POST'], 'signupcountry' => ['POST'], 'userscards' => ['POST'], 'blogdata' => ['POST'], 'blogitem' => ['POST'], 'couponhx' => ['POST'], 'couponpending' => ['POST'], 'couponredeem' => ['POST'], 'sendinterestmessage' => ['POST'], 'replyinterestmessage' => ['POST'], 'disableaccount' => ['POST'], 'myjobs' => ['POST'] ]; $res1 = []; if (array_key_exists($endpoint, $endpoints)) { } else { http_response_code(404); // tell the user product does not exist echo json_encode([ 'message' => 'Endpoint not found.', 'URI' => $uri, ]); } // echo "EXYTACT INPUT DATA HERE"; $raw_json = file_get_contents('php://input'); $raw_array = json_decode($raw_json, true); if ($_SERVER['REQUEST_METHOD'] == 'GET') { log_message('critical', "Enpoint LOC2 HERE -> ".$endpoint ); $get_param = $_GET['reqData'] ?? null; $raw_array = ($get_param!=null) ? json_decode($get_param, true):[]; } $res1 = $this->dummyData($raw_array); return $this->response->setJson($res1); } private function dummyData($raw_array) { return [ 'msg' => 'Not implemented yet', 'raw_data' => $raw_array, ]; } }