I have this simple code
<?php
$json = array("status" => $_POST['name']);
header('Content-type: application/json');
echo json_encode($json);
?>
and when i send POST data with Advanced REST cliend
, allways have an empty $_POST table.
I have this simple code
<?php
$json = array("status" => $_POST['name']);
header('Content-type: application/json');
echo json_encode($json);
?>
and when i send POST data with Advanced REST cliend
, allways have an empty $_POST table.
You are using wrong transport method. If you want to read POST data in $_POST array you have to send it either as multipart or www form urlencoded.
To read the request body you have to use following code:
$postdata = file_get_contents("php://input");
Then you can parse the JSON and transform it to object.
If you want to read the data from the request using $_POST
array you need to set Content-Type header to application/x-www-form-urlencoded
and send the data as:
param-name=param+value
(note that it is url encoded).