Difference and contact between get and post requests

Source: Internet
Author: User

HTTP defines different ways to interact with the server, with 4 basic methods, namely get,post,put,delete. URL full name is a resource descriptor, we can think: a URL address, which is used to describe a network of resources, and HTTP get,post,put,delete corresponding to this resource, change, increase, delete 4 operations.

Get is typically used to get/query resource information, and post is typically used to update resource information.

1.GET method

The Get method is used primarily to submit data, not to modify the data, without affecting the contents of the repository.

The Get method submits data is unsafe, the data is placed in the request line, the client address bar is visible,(for example: GET request data is appended to the URL (that is, the data is placed in the HTTP protocol header), to split the URL and transfer data, the parameters are connected to &, such as: LOGIN.ACTION?NAME=HYDDD&PASSWORD=IDONTKNOW&VERIFY=%E4%BD%A0%E5%A5%BD. If the data is an English letter/number, sent as is, if it is a space, converted to +, if it is Chinese/other characters, the string is directly encrypted with BASE64, such as:%E4%BD%A0%E5%A5%BD, where the xx in%xx is the symbol in 16 binary notation ASCII. Browsers generally cache your login netease, URLs are also cached, so that others can see your login user name and password.

GET http://weibo.com/signup/signup.php?invitecode=2388493434  Host:weibo.com  Accept:text/html,application/xhtml+xml,application/xml;q=0.9, image/webp,*/*; q=0.8  

The data size for the GET method submission is limited to 255 characters

Get uses a URL or cookie to pass a parameter.

2.POST method

Post puts the data in the body

Post is the ability to update data(for example, when a user adds a comment, causing the repository content to change to submit data using the Post method).

The Post method submits data security, the data is placed inside the message body, the client is not visible, and the post puts the data in the body, as in the item=bandsaw 2647

post/inventory-check.cgi http/1.1  Host:www.joes-hardware.com  Content-type: text/Plain  Contentof  item2647

There is no limit to the size of data submitted by the POST method

Difference and contact between get and post requests

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.