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

后端 未结 14 1739
-上瘾入骨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:21
    1. GET method is use to send the less sensitive data whereas POST method is use to send the sensitive data.
    2. Using the POST method you can send large amount of data compared to GET method.
    3. Data sent by GET method is visible in browser header bar whereas data send by POST method is invisible.
    0 讨论(0)
  • 2020-11-21 07:23

    Get and Post methods have nothing to do with the server technology you are using, it works the same in php, asp.net or ruby. GET and POST are part of HTTP protocol. As mark noted, POST is more secure. POST forms are also not cached by the browser. POST is also used to transfer large quantities of data.

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

    GET and POST are HTTP methods which can achieve similar goals

    GET is basically for just getting (retrieving) data, A GET should not have a body, so aside from cookies, the only place to pass info is in the URL and URLs are limited in length , GET is less secure compared to POST because data sent is part of the URL

    Never use GET when sending passwords, credit card or other sensitive information!, Data is visible to everyone in the URL, Can be cached data . GET is harmless when we are reloading or calling back button, it will be book marked, parameters remain in browser history, only ASCII characters allowed.

    POST may involve anything, like storing or updating data, or ordering a product, or sending e-mail. POST method has a body.

    POST method is secured for passing sensitive and confidential information to server it will not visible in query parameters in URL and parameters are not saved in browser history. There are no restrictions on data length. When we are reloading the browser should alert the user that the data are about to be re-submitted. POST method cannot be bookmarked

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

    I use GET when I'm retrieving information from a URL and POST when I'm sending information to a URL.

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

    Use GET method if you want to retrieve the resources from URL. You could always see the last page if you hit the back button of your browser, and it could be bookmarked, so it is not as secure as POST method.

    Use POST method if you want to 'submit' something to the URL. For example you want to create a google account and you may need to fill in all the detailed information, then you hit 'submit' button (POST method is called here), once you submit successfully, and try to hit back button of your browser, you will get error or a new blank form, instead of last page with filled form.

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

    The best answer was the first one.

    You are using:

    • GET when you want to retrieve data (GET DATA).
    • POST when you want to send data (POST DATA).
    0 讨论(0)
提交回复
热议问题