When using XML-RPC, the server gets the client data, mainly through the PHP input stream, rather than the $_post array. So, here's the main discussion of PHP input stream php://input
For a php://input introduction, the PHP Official Handbook document has a very clear overview of it.
"Php://input allows to read raw POST data. It is a less memory intensive alternative to $HTTP _raw_post_data and does no need any special php.ini. Php://input is isn't available with enctype= "Multipart/form-data".
Translation over, is this:
"Php://input can read post data that has not been processed. Compared to $http_raw_post_data, it brings less pressure on memory and does not require special php.ini settings. Php://input cannot be used for Enctype=multipart/form-data ".
1,content-type value is application/x-www-form-urlencoded, PHP will fill the HTTP request body corresponding data into the array $_post, fill in the $_ The data in the post array is the result of UrlDecode () parsing. (In fact, in addition to the Content-type, there are multipart/form-data to represent the data is form data, later we introduce)
2,php://input data, as long as the Content-type is not multipart/form-data (this condition is described later). Then the php://input data is consistent with the HTTP entity body part data. The length of the consistent data in this section is specified by Content-length.
3, the $_post data is "consistent" with the Php://input data only when Content-type is application/x-www-form-urlencoded and the Submit method is a post method (quotes, indicating that they are inconsistent in format, Content). In other cases, they are inconsistent.
4,php://input cannot read $_get data. This is because the $_get data is written in the path field of the HTTP request header (header) as Query_path, rather than in the body portion of the HTTP request.
I believe we have a certain depth of understanding of the php://input. So what is $http_raw_post_data? $http _raw_post_data is a global variable built into PHP. It is used for PHP, in the case of unrecognized content-type, to fill the post data into the variable $http_raw_post_data. It also fails to read post data that Content-type is multipart/form-data. You need to set the Always_populate_raw_post_data value in php.ini to on,php to always fill in the post data into the variable $http_raw_post_data.
Learning Notes 1,coentent-type Only if the value is application/x-www-data-urlencoded and Multipart/form-data two, PHP will populate the HTTP request packet with the corresponding data in the global variable $_post
2,php Unrecognized content-type type, the corresponding data in the HTTP request package is filled into the variable $http_raw_post_data
3, PHP will not fill in the HTTP request packets of the corresponding data in the Php://input, otherwise, only when Coentent-type is not multipart/form-data. The length of the fill, specified by Coentent-length.
4, php://input data is consistent with $_post data only when Content-type is application/x-www-data-urlencoded.
5,php://input data is always the same as $http_raw_post_data, but php://input is more effective than $http_raw_post_data and does not require special settings php.ini
6,php fills the query_path portion of the path field into the global variable $_get. Normally, the body is empty for the HTTP request submitted by the Get method.
The simulated server-side program is as follows:[PHP] View Plain copy <?php //@file phpinput_server.php $raw _post_data& Nbsp;= file_get_contents (' php://input ', ' r '); echo "-------\<pre class=" PHP " name= "code" >{1}</pre><br> POST------------------\ n "Echo var_dump (<pre class= "PHP" name= "code" >{1}</pre><br> POST) . "\ n";echo "- ------Php://input-------------\ n ";echo $raw _post_data . " \ n ";? > <pre></pre> <p><br> </p> <p> simulate client script as follows:</p> <p> </p> <pre class= "PHP" Name= "code" ><?php //@file phpinput_post.php $http _entity_body = ' n= ' . urldecode (' perfgeeks ') . ' &= ' . urlencode (' 7788 '); $http _entity_type = ' application/x-www-form-urlencoded '; $http _entity_length = strlen ($http _entity_ Body); $host = ' localhost '; $port = 80; $path = '/ceshi/phpinput_server.php '; $fp = fsockopen ($host, $port, $error _no, $error _desc, 30); if ($fp) { fputs ($FP, "post {$path} http/1.1\r\n"); fputs ($fp, "Host: { $host}\r\n "); fputs ($fp, " content-type: {$http _entity_type}\r\n ") ; fputs ($fp, "content-length: {$http _entity_length}\r\n"); fputs ($fp, "connection: close\r\n\r\n"); fputs ($fp, $http _entity_body . "\r\n\r\n"); while (!feof ($fp)) { $d .= fgets ($fp, 4096); } fclose ($fp); echo