PHP to get the JSON data in post _php tutorial

Source: Internet
Author: User
Tags http post php server
Suddenly think of the previous contact Flash will picture binary stream to PHP, brainwave with $globals[' http_raw_post_data '] get to.
So in-depth check, the original PHP default only recognizes the application/x-www.form-urlencoded standard data type, therefore, the type such as text/xml or soap or Application/octet-stream Such content can not be resolved, if you use the $_post array to receive will fail! So keep the prototype and give it to $globals[' Http_raw_post_data ') to receive it.

PHP's Http_raw_post_data
With the Content-type=text/xml type, submit an XML document content to the PHP server, how to get this post data.
The raw/uninterpreted HTTP POST information can be accessed with: $GLOBALS [' http_raw_post_data '] this is useful in cases Where the post content-type is not something PHP understands (such as Text/xml).
Since PHP only recognizes the application/x-www.form-urlencoded standard data type by default, the contents of the type such as text/xml cannot be parsed into the $_post array, so the prototype is retained and given to $globals[' Http_raw_ Post_data '] to receive.
There is also a php://input that can be implemented with this function
Php://input allows the raw data to be read from the POST. Compared to $HTTP _raw_post_data, it brings less pressure to memory and does not require any special php.ini settings. Php://input cannot be used for enctype= "Multipart/form-data".

Application

A.htm
Copy CodeThe code is as follows:


post.php
Copy CodeThe code is as follows:

http://www.bkjia.com/PHPjc/323592.html www.bkjia.com true http://www.bkjia.com/PHPjc/323592.html techarticle suddenly think of the previous contact Flash will picture binary stream to PHP, brainwave with $globals[' http_raw_post_data '] get to. So in-depth check, the original PHP default only ...

  • Related Article

    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.