$str_ServerURL = $arr_ParsedPath[1]; $str_Entity = $arr_ParsedPath[2]; $int_ID = $arr_ParsedPath[3]; $str_Method = $arr_ParsedPath[4]; // Get the request body if the requets method is POST and rewrite it if ($str_RequestMethod == 'POST') { $str_RequestBody = file_get_contents('php://input'); $arr_RedirectFields = array('ID' => $int_ID != '' ? $int_ID : NULL, 'method' => $str_Method, 'data' => $str_RequestBody); } elseif ($str_RequestMethod == 'GET') { $arr_RedirectFields = $int_ID != '' ? array('ID' => $int_ID) : array(); $arr_RedirectFields = array_merge($arr_RedirectFields, $_GET); } // Redirect the request $str_RedirectUrl = $str_ServerName . $str_ServerURL . '/rest-api/controllers/' . $str_Entity . '.php'; $obj_Curl = new CurlRequest(); $obj_Curl->setCookie('GawainSessionID', $str_SessionID); $obj_Curl->setCookie('GawainUser', $str_User); $obj_Curl->setCookie('GawainClientIP', $_SERVER['REMOTE_ADDR']); if ($str_RequestMethod == 'GET') { $obj_Curl->get($str_RedirectUrl, $arr_RedirectFields); } elseif ($str_RequestMethod == 'POST') { $obj_Curl->post($str_RedirectUrl, $arr_RedirectFields); } if ($obj_Curl->error) { echo 'Error ' . $obj_Curl->error_code . ': ' . $obj_Curl->error_message; } else { switch ($obj_Curl->http_status_code) { case 200: $arr_ResponseHeader = explode(PHP_EOL, trim($obj_Curl->raw_response_headers)); foreach ($arr_ResponseHeader as $str_ResponseHeader) { header($str_ResponseHeader);