$ POST, $ HTTP_RAW_POST_DATA, and php: // differences between input

Source: Internet
Author: User
Differences between $ POST, $ HTTP_RAW_POST_DATA, and php: input
$ POST, $ HTTP_RAW_POST_DATA, and php: // differences between input
Always generate variables that contain original POST data. Otherwise, this variable is generated only when data of the unrecognized MIME type is encountered. However, a better way to access the original POST data is php: // input. $ HTTP_RAW_POST_DATA is unavailable for enctype = "multipart/form-data" form data. Question: $ HTTP_RAW_POST_DATA ==$ _ POST? The answer is No.My personal understanding is like this:
1: $ POST. we don't need to introduce the common ones.

2:$GLOBALS['HTTP_RAW_POST_DATA']:
Basically, $ GLOBALS ['http _ RAW_POST_DATA '] is the same as $ _ POST. However, if the post data is not recognized by PHP, you can use $ GLOBALS ['http _ RAW_POST_DATA '] to receive the data, such as text/xml or soap. The default data Type recognized by PHP is the application/x-www.form-urlencoded standard data Type, with Content-Type = text/xml Type, submit an xml document Content to the php server, how to obtain the POST data. The RAW/uninterpreted http post information can be accessed: $ GLOBALS ['http _ RAW_POST_DATA '] This is useful in cases where the post Content-Type is not something PHP understands (such as text/xml ). because PHP only recognizes the application/x-www.form-urlencoded standard data type by default, the content of the type such as text/xml cannot be parsed as $ _ POST array, so the prototype is retained, it is sent to $ GLOBALS ['http _ RAW_POST_DATA '] for receiving.
3: php: // input can also implement this function: php: // input allows reading the 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 ". Example: leyangjun.html leyangjun. php:
 "; Print_r ($ _ POST); $ data = file_get_contents ('php: // input'); // unlock the print_r (urldecode ($ data); echo"
"; Print_r (urldecode ($ GLOBALS ['http _ RAW_POST_DATA ']);?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.