<?php
$json=file_get_contents('php://input',true);
$data = json_decode($json, true);
print_r($data);
?>
Output given is {"EventTitle":"Game","EventBody":"body","EventDate":"20 November, 2016","EventType":"party"}
Json Data posted is:
{"EventTitle":"Game","EventBody":"body","EventDate":"20 November, 2016","EventType":"party"}
Writing the json data in a variable and passing it to json_decode works but posting the same from the "php://input" returns a JSON data instead of associative array.
var_dump($json)print?string(107) ""{\"EventTitle\":\"Game\",\"EventBody\":\"body\",\"EventDate\":\"20 November, 2016\",\"EventType\":\"party\"}""file_get_contents('php://input',true);tofile_get_contents('php://input');?{"EventTitle":"Game","EventBody":"body","EventDate":"20 November, 2016","EventType":"party"}