How is the http post method applied?

I know that I want to know what happens behind the scene of the HTTP post method. the browser sends an HTTP request to the server side of the script in PHP (for example).

How does the PHP variable $ _POST get values ​​from the client.

Can someone explain in detail or point to a guide.

+5
source share
4 answers

The HTTP protocol (*) indicates how the browser should send the request.

HTTP basically consists of a set of headers in text form, separated by a line, and then transmitted data. Inside an HTTP request, POST data is actually formatted in much the same way as GET data; this is just another part of the HTTP headers.

, Firebug Fiddler, , HTTP-. , , .

, PHP HTTP $_GET, $_POST .. , PHP .

(, Perl) , Perl . , Perl , , , Perl .

PHP, , . , HTTP- , .

PHP , , , , , PHP , .

. HTTPS, , . , PHP , Apache , , PHP, .

(*) - , , , "HTTP-" - , "ATM-" "PIN-".

+4

, POST. PHP $_POST ( , [ ] .).

+1

- (, Fiddler) (, Wireshark) ; .

, POST GET, , URL-, ( multipart-form urlencode GET)

0

, , , [form action = "foo.php" method = "post" ]

"" ( "Enter" ), "". javascript/dom, , Ajax.

false, ( XMLHttpRequest).

, , , , , .

, - ( ):

POST /foo.php HTTP/1.1
Host: example.org
Content-Type: application/x-www-form-urlencoded
Content-Length: 7

foo=bar

POST. , . , ( POST). POST, , .

. , , (foo = bar; xxx = baz) , PHP Python Java...

. , , GET, POST- !

[form action = "foo.php? someVar = 123 & anotherVar = TRUE" method = "post" ]

POST /foo.php?someVar=123&anotherVar=TRUE HTTP/1.1
Host: example.org
Content-Type: application/x-www-form-urlencoded
Content-Length: 7

foo=bar

:

  • GET [someVar] = 123
  • GET [anotherVar] = TRUE
  • POST [foo] = bar
0

All Articles