} else { header('Not Implemented', true, 501); die; } } else { header('Not Implemented', true, 501); die("Plugin not installed"); } /* * Force headers or debug mode */ if (isset($_REQUEST["debug"])) { var_dump($result); die; } header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); header("Pragma: no-cache"); header("Content-Type: application/json; charset=utf-8"); claro_utf8_encode_array($result); echo json_encode($result); } catch (RuntimeException $ex) { header($ex->getMessage(), true, $ex->getCode()); echo $ex->getMessage(); //die(); } catch (Exception $ex) { header('Bad Request', true, 400); echo $ex->getMessage(); //die(); }
/** * Get JSON code for the response * @return string JSON code (utf-8 encoded) */ public function toJson() { $response = $response = array('responseType' => $this->type, 'responseBody' => $this->body); claro_utf8_encode_array($response); return json_encode($response); }