¿Cómo llenan los servidores web $ _POST & $ _GET?

I am writing a Java web server and right now I am able to service .HTML files fine, but I am having a hard time figuring out how to handle .PHP files which require $_POST and $_GET.

How do web servers usually fill these arrays? There is no way to fill them using the command-line from what I can tell since I was originally thinking to pipe the stdout of an exec("php whatever.php some $_get args), but that's not possible without physically changing the php code to exploding the args and filling them into $_GET which I don't want to do -- I want to do it the way web servers do it.

Does anyone have suggestions of how web servers do things like this?

preguntado el 28 de agosto de 11 a las 02:08

Also you cannot use the normal php interpreter. You need the php-cgi variante: stackoverflow.com/questions/7047426/… -

1 Respuestas

You can use interface with PHP via Interfaz de Entrada Común (CGI), which boils down to setting up a bunch of environment variables and then invoking PHP.

REQUEST_METHOD="GET"
QUERY_STRING="param1=value1&param2=value2"

The CGI protocol is defined in RFC 3875.

Respondido 28 ago 11, 06:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.