• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Diff betwn Get and Post

 
Manish Jaju
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some doubt regarding post and get methods, used to process a request... What I understood, that if parameters append with URL then get is used and to send it hidden, post is used... Is there any other specific reason to use get or post except I mentioned above. Please clarify
 
gaurav chhabra
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if someone can catch ur mathord then he can easily trap ur info.in GET but not in POST.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To me it's more about your intent than their usage. Cryptic, but what I mean is that if you are submitting data, use POST, but if you are sending data to recieve information, use GET.

Examples of the 'POST' type are easy: submitting forms, sending personal info etc.
Example of the GET type are things like catalogues, where you send a product ID to a product page to see that product.

It's as much an art as a science, but I saw a reasonable quote here that said GET should be considered idempotent - that is, it doesn't change the state of the server and repeated calls return the same response (with the exception of page trackers etc).
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, note that get is the default if no other method is specified.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Advantages of GET:

  • Because the params are part of the URL, they can be included in an anchor tag.
  • The params will be retained if the user bookmarks the page (this thread is a good example).

  • Note: This can also be seen as a disadvantage, depending on your needs.
  • The params will show up in the header's 'referer' variable. (This is particularly usefull with Yahoo and Google searches).


  • Advantages of POST:
  • Because the params are not part of the URL, usernames and passwords will not show up, plain text, in the address window of the browser.
  • The browser automatically encodes all the text for you. (Now this is also done for GET requests but with some older browsers, you will need to do this explicitly).
  • With older browsers (Netscape 4.7) there was a 255 character limit to the URL length. If your app has to support older browsers, watch out for this one if you are using GET.
  • You can send any type of data by setting the mime type. Not a big issue with browser apps but usefull for applets.


  • Those are the ones I can think of off the top of my head.
    [ January 24, 2005: Message edited by: Ben Souther ]
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic