<?php

ini_set("display_errors", 0);
error_reporting(E_ALL);

if (isset($_SERVER['REQUEST_METHOD']) && isset($_SERVER['CONTENT_TYPE']) && strstr($_SERVER['CONTENT_TYPE'], "application/json")) {
    $input = file_get_contents('php://input');
    $json = json_decode($input, true);
    if (is_array($json)) {
        $_REQUEST = array_merge($_REQUEST, $json);
        if ($_SERVER['REQUEST_METHOD'] == "GET") {
            $_GET = array_merge($_GET, $json);
        } elseif ($_SERVER['REQUEST_METHOD'] == "POST") {
            $_POST = array_merge($_POST, $json);
        }
    }
}