What are the differences between GET and POST in HTTP?

Source: Internet
Author: User

What are the differences between GET and POST in HTTP? HTTP defines different methods for interaction with the server. The four most common methods are Get, Post, Put, and Delete, if I change the order, I can easily remember: Put (ADD), Delete (Delete), Post (change), Get (query), that is, add, Delete, modify, and query. The following is a brief description: 1) Get, which is used to obtain information. Note that it only obtains and queries data, that is, it does not modify the data on the server. In this case, it is data secure, post, which will be mentioned later, can modify data, so this is also one of the differences between the two. 2) Post: it can send a modification request to the server to modify the server. For example, if we want to reply to the Forum and comment on the blog, Post is required, of course, it can only obtain data. 3) Delete to Delete data. It can be implemented through Get/Post. It is not used much. It does not need to be written at the moment and will be expanded later. 4) Put, add and place data, which can be achieved through Get/Post. It is not used much. It does not need to be written at the moment and will be expanded later. The differences between Get and Post are briefly described below: 1) the data of the GET request is placed in the HTTP header, that is, after the URL, the format is usually defined as follows, (Post stores the submitted data in the HTTP body ). Login. action? Name = hyddd & password = idontknow & verify = % E4 % BD % E5 % A5 % BD a,? To separate URL and data; B to separate parameters with &; c. If the data is English or a number, it is sent as is; d. If the data is Chinese or other characters, is base64-encoded. 2) GET submits less data, up to B, because GET data is appended to the URL, and the URL will be restricted by different environments, for example, Internet Explorer has a limit of 2 K + 35, while POST can transmit more data (Theoretically there is no limit, but it is generally subject to different environments, for example, IIS4 supports 80 KB and IIS5 supports kb ). 3) Post is more secure than Get because the parameter data is transmitted in plain text during Get, and the Cross-site request forgery attack may be caused by GET. The POST data can be encrypted, but the GET speed may be faster. To sum up the following points: operation Method: Data Location plaintext ciphertext Data Security length restriction Application Scenario get http header plaintext insecure length small query data post http body clear and confidential security support large data transmission modify 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.