I've got Postman (the one that doesn't open in Chrome) and I'm trying to do a POST request using raw json.
In the Body tab I have "raw" selected and "JSON (application/json)" with this body:
{
"foo": "bar"
}
For the header I have 1, Content-Type: application/json
On the PHP side I'm just doing print_r($_POST);
for now, and I'm getting an empty array.
If I use jQuery and do:
$.ajax({
"type": "POST",
"url": "/rest/index.php",
"data": {
"foo": "bar"
}
}).done(function (d) {
console.log(d);
});
I'm getting as expected:
Array
(
[foo] => bar
)
So why isn't it working with Postman?
Postman screenshots:
and header: