Imagine you have a webhook on your server and someone sends a JSON body POST to it.
The data is not available in the global $_REQUEST or $_POST variables as you’d expect.
To access the JSON data you’ll need to get the POST’s RAW DATA:
1 2 3 | <?php $postData = file_get_contents("php://input"); // <-- eg: {"key":1, "key2":2} $arr_data = json_decode($postData, true); // <-- array('key1' => 1, 'key2' => 2) |
More on this: http://us.php.net/manual/en/wrappers.php.php#wrappers.php.input