When should I use GET or POST method? What's the difference between them?

后端 未结 14 1767
-上瘾入骨i
-上瘾入骨i 2020-11-21 06:44

What\'s the difference when using GET or POST method? Which one is more secure? What are (dis)advantages of each of them?

(similar question

相关标签:
14条回答
  • 2020-11-21 07:41

    When the user enters information in a form and clicks Submit , there are two ways the information can be sent from the browser to the server: in the URL, or within the body of the HTTP request.

    The GET method, which was used in the example earlier, appends name/value pairs to the URL. Unfortunately, the length of a URL is limited, so this method only works if there are only a few parameters. The URL could be truncated if the form uses a large number of parameters, or if the parameters contain large amounts of data. Also, parameters passed on the URL are visible in the address field of the browser not the best place for a password to be displayed.

    The alternative to the GET method is the POST method. This method packages the name/value pairs inside the body of the HTTP request, which makes for a cleaner URL and imposes no size limitations on the forms output. It is also more secure.

    0 讨论(0)
  • 2020-11-21 07:45

    The GET method:

    • It is used only for sending 256 character date

    • When using this method, the information can be seen on the browser

    • It is the default method used by forms

    • It is not so secured.


    The POST method:

    • It is used for sending unlimited data.

    • With this method, the information cannot be seen on the browser

    • You can explicitly mention the POST method

    • It is more secured than the GET method

    • It provides more advanced features

    0 讨论(0)
提交回复
热议问题