V
V
Viktor Familyevich2018-05-15 12:46:48
PHP
Viktor Familyevich, 2018-05-15 12:46:48

How to accept JSON in POST request in PHP?

Guys, please tell me how to convert json to a regular array? In the php script, the POST method passes JSON with the following content:

{
"qqq":"www",
"eee":"rrr"
}

The code takes it like this:
$s = json_decode($_POST, true);
var_dump($s);

var_dump for some reason produces NULL, although $s should contain the decoded array, did I understand correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lander, 2018-05-15
@Wintego

Well, in $_POST, there should probably be some kind of field.
Or
upd: Interesting to read on the topic

G
GTRxShock, 2018-05-15
@GTRxShock

Conclusion var_dump($_POST);to the studio

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question