Issue
You are unable to receive the HTTP body when you write the HttpEndpoint operation in PHP.
Cause
This may be because the PHP program uses the $_POST[]
method to obtain the HTTP body (HttpBody). The $_POST[]
method can receive only data of the following content type. The data is submitted from a form by sending a POST request.
application/x-www-form-urlencoded
Push requests of Simple Message Queue (formerly MNS) support only the following content types:
text/xml;charset=utf-8
text/plain;charset=utf-8
application/json;charset=utf-8
Solution
Check whether your PHP code directly obtains the HTTP body by using the $_POST[]
method. If the code directly obtains the HTTP body by using the $_POST[] method, we recommend that you change to the following method:
file_get_contents("php://input");
This method allows you to read and obtain the raw data from a POST request. It can be used for POST data of different content types, and even for data with no type specified.
If the issue persists, you can log on to Alibaba Cloud Community for free consultation. For more information, see Developer Community.