Answer the question
In order to leave comments, you need to log in
How to get PHP POST request in JSON format from console?
Good day. I know this is a very stupid question, but I haven't been able to find an answer for the whole day.
We send a request with data to php from the console. And, it needs to be processed.
$ curl ' 127.0.0.1:8000/index.php ' -X POST -H 'Content-Type: application/json' --data-binary '["hello", "racecar", "Level", "lol"] '
With a simple POST request, I was able to process the input.
$ curl ' 127.0.0.1:8000/index.php ' -X POST --data-binary 'var=["hello", "racecar", "Level", "lol"]'
Used echo $_POST['var' ];
Tell me what to use to process the incoming JSON array?
Through json_decode could not achieve the result.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question