Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm studying making a CGI program. Now I can print text what I want. But how can I get GET or POST input from CGI program? (such as query-string or post-body)

share|improve this question
up vote 2 down vote accepted

The query string is accessible via the environmental variable called REQUEST_URI. If the client sent a POST request, then the contents will be available through the standard input.

See the Apache tutorial for a brief info (this is where the above sentences have been copied from).

By the way, most scripting language provides some kind of CGI support (for example, perl's CGI documentation is here), so the one you use surely has methods for extracting data from the request as well.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.