• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Diff betwn Get and Post

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if someone can catch ur mathord then he can easily trap ur info.in GET but not in POST.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, note that get is the default if no other method is specified.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
    reply
      Bookmark Topic Watch Topic
    • New Topic