noHeaders = true; $contextClass = Config::get('gadget_context_class'); $context = new $contextClass('GADGET'); $makeRequestParams = MakeRequestOptions::fromCurrentRequest(); $makeRequestHandlerClass = Config::get('makerequest_handler'); $makeRequestHandler = new $makeRequestHandlerClass($context); $makeRequestHandler->fetchJson($makeRequestParams); } catch (MakeRequestParameterException $e) { // Something was misconfigured in the request header("HTTP/1.0 400 Bad Request", true); echo "

400 - Bad request

" . $e->getMessage() . ""; } catch (\Exception $e) { // catch all exceptions and give a 500 server error header("HTTP/1.0 500 Internal Server Error"); echo "

Internal server error

" . $e->getMessage() . "

"; } } public function doPost() { $this->doGet(); } }