Leon Helmsley
Leon Helmsley

Reputation: 595

Why does $_POST have a larger size limit than $_GET?

I know that $_POST has a larger size limit than $_GET, but why? What is $_GET limited by?

Upvotes: 4

Views: 502

Answers (4)

hek2mgl
hek2mgl

Reputation: 158020

$_GET is transferred within the url and is therefore limited by its maximum size. Where there is no theoretical maximum url size defined with the HTTP standard, it is limited by many browsers and servers. Refer to this FAQ which advices your application to use urls that are smaller than 2000 chars

$_POST is transfererred within the request body which is also theoretical unlimited, but as with $_GET there are limits by browsers and servers. But they are usually much higher.

For you info: To adjust the maximum post size in php use the ini value

post_max_size=...

Upvotes: 4

JSON C11
JSON C11

Reputation: 11800

The GET method adds the data to the URL; and the length of a URL is limited (maximum URL length is 2048 characters).

Upvotes: 1

Amadan
Amadan

Reputation: 198334

GET parameters are all passed as a part of the URL. URL length is limited, depending on the browser and web server; the biggest limitation is IE, which limits URLs to 2083 bytes.

Upvotes: 3

Adam Szabo
Adam Szabo

Reputation: 11412

This is the way HTTP was defined. GET is intended to be used mainly for getting data, whilst POST is for sending data.

Some details on limitations and differences: http://www.w3schools.com/tags/ref_httpmethods.asp

Upvotes: 4

Related Questions