The difference between the sum POST HTTP request method of GET

GET request method:

  If our pages to collect user data, he specified, this page user data request method of GET to deal with it, we will find, such as Baidu, it is a very classic way of GET requests

  When we entered on the Baidu search for a 'java', click on Baidu, that this page will collect the data that we want to search and submit Baidu server dealt with, show some results of the search, then this is a classic GET request

   

 

  With a question mark every request data directly in the back of my url, we see that "wd = java", this is what we wrote that "java"

 

As shown in the body of the request, the content is no, because, GET request method is to request data '? By 'splicing request address in the request header inside the inside, and in the address bar is visible 

 

     

 

 

POST request method:

  Request data is sent in the request entity, the data is not visible in the URL request.

  In the POST request, the request is put your data in the body of the request, rather than behind the url address.

 

 

Advantages and disadvantages:

  GET:

    1, in a direct fight back url, can see, it is not safe.

      For example, you wrote a login function, one-click login to your account password spelling in the back url, so this is and unsafe.

    2, carrying the HTTP data requested is no limit how much you want to say how much incidental comes, for example, you upload a file, just the time to upload a matter of time.

       However, the address bar of the browser, because the GET that you want to display in the address bar of your browser is length limit. So GET method only a small number of incoming. Not because the HTTP protocol.

  POST:

    1, request data is transmitted in the requesting entity, in the specific visible url request information security.

    2, POST has a separate request data which is transmitted, then this one is a single system, it is not to limit the size of the POST.

    

 

 to sum up:

    If your data security less demanding, and the relatively small amount of data, you can have GET; the contrary, if your high data security requirements, and a large amount of data, you can have a POST

   But often is the first to measure the dimension of security, not the amount of data, but security, even at the expense of efficiency, but also improve security.

      Some may say that I direct POST does not get away with it? Because GET efficiency is higher than the POST.

 

Guess you like

Origin www.cnblogs.com/qzhc/p/11302195.html