differences betweenGET andPOST
Moderator: General Moderators
differences betweenGET andPOST
What are the differences betweenGET andPOST methods in form submitting, give the case where we can use get and we can use post methods
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: differences betweenGET andPOST
The practical difference is that GET includes the parameter values in the URL. Post puts the parameter values in the body of the request.
http://en.wikipedia.org/wiki/Hypertext_ ... r_Protocol
http://en.wikipedia.org/wiki/Hypertext_ ... r_Protocol
(#10850)
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: differences betweenGET andPOST
use POST if you want your requests not to be cached
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: differences betweenGET andPOST
GET should only be used to retrieve or "get" data. Use POST to send data that will result in a consequence (delete record, insert record, send email, etc.).
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: differences betweenGET andPOST
Moved to PHP-Code.
Re: differences betweenGET andPOST
Well while it's true, it's not always trueDigitalMind wrote:use POST if you want your requests not to be cached
GET caching is easily solved by adding an unique parameter to the GET request - like this:
[text]http://domain.com?param1=value1¶m2= ... value_here}[/text]
the {unique_value_here} is usually the current time in milliseconds (an ever incrementing value, thus it's unique).
There are 10 types of people in this world, those who understand binary and those who don't
Re: differences betweenGET andPOST
Just to elaborate - a GET request is vulnerable to CSRF thus a GET request should be used only and if only a pure "read" request is meant - i.e. no data changes required.AbraCadaver wrote:GET should only be used to retrieve or "get" data. Use POST to send data that will result in a consequence (delete record, insert record, send email, etc.).
Another aspect of when to use a GET request can be found in RESTful services, though I'm not a big fan of it.
There are 10 types of people in this world, those who understand binary and those who don't
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: differences betweenGET andPOST
It's a very dirty solution and it doesn't mean your requests won't be cached. The cache will be cluttered up.VladSun wrote:Well while it's true, it's not always true
GET caching is easily solved by adding an unique parameter to the GET request - like this:the {unique_value_here} is usually the current time in milliseconds (an ever incrementing value, thus it's unique).Code: Select all
http://domain.com?param1=value1¶m2=value2&....&__decache={unique_value_here}
Re: differences betweenGET andPOST
It's widely used by a lot of frameworks (ExtJS for sure) in order to solve cross browser caching issues. Just take a look.DigitalMind wrote:It's a very dirty solution and it doesn't mean your requests won't be cached. The cache will be cluttered up.
Last edited by VladSun on Fri Oct 01, 2010 6:13 am, edited 2 times in total.
There are 10 types of people in this world, those who understand binary and those who don't
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: differences betweenGET andPOST
Nobody told it won't work. In my opinion it's bad approach.
Re: differences betweenGET andPOST
In my opinion IE is just a tool needed to install a browserDigitalMind wrote:Nobody told it won't work. In my opinion it's bad approach.
There are 10 types of people in this world, those who understand binary and those who don't
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: differences betweenGET andPOST
Absolutely agreeVladSun wrote:In my opinion IE is just a tool needed to install a browser
Re: differences betweenGET andPOST
Ну договорились!DigitalMind wrote:Absolutely agreeVladSun wrote:In my opinion IE is just a tool needed to install a browser
There are 10 types of people in this world, those who understand binary and those who don't
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: differences betweenGET andPOST
Ага
[Yup
]