- Published: July 25, 2016
HTTP request methods are defined in RFC2616 Section 9 Method Definitions. These methods are also known as verbs as they indicate the desired action to be performed on an identified resource.
Understanding the basics in simple terms
From a practical point of view, these are the most simple (not so accurate) definitions and differences.
$_GET is an array of variables passed to the current script via the URL parameters.
$_POST is an array of variables passed to the current script via the HTTP POST method.
POST /data/form HTTP/1.1 Host: example.com name1=value1&name2=value2
When to use GET vs POST methods
In most cases:
|Can be __cached__|
|Remain in the __browser history__|
|Can be __bookmarked__|
|Data visible in URL|
|Used with __sensitive data__|
|__Data length__ restrictions|
|ASCII data type allowed|
|Binary data type allowed|
A search page should use GET, while a form that changes your password should use POST.