Web-Is it possible for the app to have a post, and PHP can get it directly?

Source: Internet
Author: User
Tags php language
The other person said that they use asihttp,post come over.

So can I receive it directly? And how do I detect if I have received data from someone else post or someone else has not sent the data over?


  
   

Reply content:

The other person said that they use asihttp,post come over.

So can I receive it directly? And how do I detect if I have received data from someone else post or someone else has not sent the data over?


  
   

No, the post is also required to be key value to $_post read.
$raw = file_get_contents ("Php://input", "R");

can accept any form of post data

This is the PHP language and will only be executed if someone submits the post. So you need to know if someone else is post.
If you are wondering how to verify the data submitted by your own app, you can consider using a signature method to validate the data passed over.

As long as the network connection is not a problem, then the app sends the POST request data can be directly obtained in PHP. It is only by judging whether the received data is empty to detect whether or not to pass the data over.

First of all, for the landlord code, I have a few questions:
$json =json_decode[$json, true] this line, what do json_decode do with the array?
Mysql_close this line, without parentheses, should be mysql_close ();

Each other as long as the HTTP POST method post, you can use the post to accept, you can try to use
if (Empty ($_post[' username ')) {
Exit (' username can not is empty ');
}
To do the test.

See Nginx Log, HTTP return status, all line

  • 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.