I am trying to read in a JSON message in my PHP app and this is my php code:
$json = file_get_contents(\'php://input\');
$obj = json_decode($json, TRUE);
ech
there are two type for executing this type of request
First : you can use it as an stdClassObject for this
$data = json_decode(file_get_contents('php://input'));
it will return a object and you can retrieve data from this like
$name = $data->name;
Second : you can use it as an array for this
$data = json_decode(file_get_contents('php://input'), true);
it will return a object and you can retrieve data from this like
$name = $data['name'];