Someone asked me about how to use PHP to transfer XML to PHPCHINA today ?, The corresponding solution is provided above. By the way, let's talk about PHP input and output streams.
During the summer vacation, when my colleagues used flash to create streaming media, they needed to use PHP to read the media information transmitted by FLASH (also in XML format ), at that time, I was familiar with the basic input/output stream principle of PHP.
The manual says:
PHP 3.0.13 and later versions. PHP: // output and php: // input are supported since php 4.3.0 and PHP: // filter is supported since php 5.0.0.
Php: // stdin
Php: // stdout
Php: // stderr
Php: // output
Php: // input
Php: // filter
Php: // stdin, php: // stdout and php: // stderr allow access to the corresponding input or output stream of the PHP process.
Php: // output allows writing data to the output buffer mechanism, which is the same as print () and echo.
Php: // input allows reading original POST data. Compared with $ HTTP_RAW_POST_DATA, it puts less pressure on the memory and does not require any special php. ini settings. Php: // input cannot be used for enctype = "multipart/form-data ".
Php: // stdin and php: // input are read-only, while php: // stdout, php: // stderr and php: // output are only written.
Php: // filter is an encapsulation protocol designed to allow the filter program to flow when it is opened. This is useful for file functions with complete functions such as readfile (), file (), and file_get_contents (). Otherwise, you will not be able to apply the filter to the stream before reading the content.
That is to say, the original post data is saved in a file named php: // input. You can use simple file operations to read data.
$ Data = file_get_contents (php: // input );