Now we need to write an api interface, using the post method. Other companies send json data to this api post
But here comes the problem. When I tested it myself, I used $_POST to receive the data at the beginning. When simulating sending, I used PHP's curl mode to post it, and everything was normal. Then when the other party called the api, it said it failed. When I saw it, the received data was empty. I used Fiddler to simulate the post request, and it also failed. It is indeed empty, $_POST cannot receive data, and then I use php://input to receive it successfully. However, I don’t know why, if I use php://input, my php uses curl to simulate the post, but it can’t be received! ! ! !
That is to say
curl post =>> $_POST
Other normal posts =>> php://input
What is this, I Baidu it
I don’t see why either
Read more documentation
http://php.net/manual/zh/rese...