I have to send a json response from a cURL call. The user send me a "test" variable to file.php.
On my php file, I use this code
$arr = array($arr = array('test' => 'ok'));
echo json_encode($arr);
And this for the cURL call
curl --request POST http://www.domain.com/WS/file.php -d '{ "test" : "12341234123412342" }'
Here is the answer
[{"test":null}]
What's the good way to get de POST variable and treat it in my php file?
Thanks
EDIT
Just in case, the problem comes from the cURL call. Here's the correct syntax:
curl -H "Content-Type: application/json" -X POST -d "{\"test\":\"12341234123412342\"}" http://www.domain.com/WS/file.php