faqts : Computers : Programming : Languages : PHP : Not Quite PHP : HTTP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

145 of 181 people (80%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Is there a limit on the size of GET and POST requests?
What are the differences between GET and POST?

Dec 27th, 2000 02:20
Philip Olson, Nathan Wallace, unknown unknown,


GET  : Data sent through variables as part of the URL
       index.php?name=sam&id=33
POST : Data Sent as a separate HTTP header.  Not seen in URL.  
If you use GET, info is logged by the server (apache).  For example, if 
you submitted password in cleartext, we can see it.  POST request data 
is not usually logged.
There used to be a limit on the length of GET requests.  Now it's 
technically "unlimited" by spec, but individual servers are allowed to 
impose a limit no lower than the old limit.
Ditto for POST, only POST was a higher old limit.
Still can't rely on the Browser, intermediary servers, and your server 
to all transmit anything over the old limit (4K?) for POST.
If you have that much stuff to schlep around, re-design you app to 
store it server side, and pass around a token to the user to maintain 
session state : 
  I'm new to Sessions and Cookies, where should I start?
     http://www.faqts.com/knowledge_base/view.phtml/aid/6621/fid/594
PHP4 session functions or http://phplib.netuse.de are good, and there 
are others, or you could roll your own.
Note that the predefined variables HTTP_GET_VARS and HTTP_POST_VARS are 
most likely available, they are useful arrays of post/get information.
A Few Resources (some more related then others) :
  METHOD=GET vs. METHOD=POST  :
     http://www.pmel.noaa.gov/toga-tao/get-vs-post.html
  PHP Manual : Variables from outside PHP
     http://www.php.net/manual/language.variables.external.php
  Predefined Variables
     http://www.php.net/manual/language.variables.predefined.php
  PHP Manual : header()
     http://www.php.net/manual/function.header.php
  HTTP Tutorial :
    http://www.stud.ifi.uio.no/~lmariusg/download/artikler/HTTP_tut.html
  Post vs Get with CGI
    http://www.abiglime.com/webmaster/articles/cgi/021098.htm
  Post / Get / and Java       : (must fix url)
     http://java.sun.com/docs/books/tutorial/servlets/client-
interaction/http-methods.html