POST string Problems

Source: Internet
Author: User
Does the HTTP Protocol stipulate that the POST content must be submitted in the form of a key-value pair? Direct POST string, PHP $ _ POST cannot receive it. Is there any way for PHP to receive the POST string? Does the HTTP Protocol stipulate that the POST content must be submitted in the form of a key-value pair? Direct POST string, PHP $ _ POST cannot receive it. Is there any way for PHP to receive the POST string?

Reply content:

Does the HTTP Protocol stipulate that the POST content must be submitted in the form of a key-value pair? Direct POST string, PHP $ _ POST cannot receive it. Is there any way for PHP to receive the POST string?

Do you want this?

php://input

If you haven't touched php for many years, you can find it intuitively. Maybe it's what you want: http://php.net/manual/en/reserved.variables.httprawpostdata.php.

1. By default, POST is an array of k-v. 2. You need to use php: // input.

$ GLOBALS ["HTTPRAWPOSTDATA "] or fileGet_contents ('php: // input ');

By default, the Content-Type of the POST request generated by HTML is application/x-www-form-urlencoded, which is a form in the key-value format that we understand.

However, since Content-Type exists, it can be of another Type in the HTTP protocol! For example, application/json, text/plain. Of course, how to deal with the server end is a matter of the server.

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.