php how to accept json code example
Example 1: how to receive json data in php
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
echo $data;
Example 2: file_get_contents('php //input')
Actually php://input allows you to read raw POST data.
It is a less memory intensive alternative to $HTTP_RAW_POST_DATA and does not need any special php.ini directives.
php://input is not available with enctype="multipart/form-data".
Reference: http://php.net/manual/en/wrappers.php.php