addRecord(\Monolog\Logger::ERROR, $e); $response = Response::error('serverError'); } // Richiesta OPTIONS (controllo da parte del dispositivo) if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { $response = Response::error('ok'); } json_decode($response); // Impostazioni di Content-Type e Charset Header if (json_last_error() == JSON_ERROR_NONE) { header('Content-Type: application/json; charset=UTF-8'); } else { header('Content-Type: text/plain; charset=UTF-8'); } // Stampa dei risultati echo $response;