Use curl to understand the request code sent by $ GLOBALS [HTTP_RAW_POST_DATA], $ _ POST, and php: input.
Post. php
Code for receiving the request
Url. php
Post. php execution result
HTTP_RAW_POST_DATA: post:Array ([a] => 123 | B = 2 [c] => 3)
Input:A = 123 | B = 2 & c = 3
CONTENT_TYPE: application/x-www-form-urlencoded
1. it indicates that if content-type is not passed, php defaults to application/x-www-form-urlencoded. php can recognize this, and $ GLOBALS ["HTTP_RAW_POST_DATA"] is blank, post is the generated array after Recognition. php: // input gets the original data.
If there is no data in the 123456 $ _ POST because no key is used, php: // The input is still the original data.
2. if you set $ header [] = "content-type: text/xml ";
The execution result is
HTTP_RAW_POST_DATA:A = 123 | B = 2 & c = 3
Post:Array ()
Input:A = 123 | B = 2 & c = 3
CONTENT_TYPE: text/xml
At this time, there is no data in Post, and there is data in HTTP_RAW_POST_DATA.
Php: // inputAlways raw data
In summary:
When content-type is the default application/x-www-form-urlencoded, php can process Post data and generate a $ _ POST array $ GLOBALS ["HTTP_RAW_POST_DATA"] in combination. no value
When content-type is of another type, php cannot process it and cannot generate the $ _ POST array. Both the original data in $ GLOBALS ["HTTP_RAW_POST_DATA"] and php: // input are original data.
Php: // input is the original post data in any case