CGI learning notes

Source: Internet
Author: User

CGI is actually a section running on the server.ProgramThe general working principle is as follows: the user sends a request to the server, then the server calls this CGI program for corresponding processing, and then returns the processing result to the server, the server then sends the result to the user.

It is complicated to say, but it is not complicated to write the CGI program, because the server has redirected the input and output of the CGI program to the standard input and output, therefore, to write a CGI program, you only need to read the information from the standard input, and then send the processing result to the standard output. In this way, you can write the CGI program in any language that supports the standard input and output, however, the output content must meet the HTTP protocol.

The following is a CGI program written in shell to display time:

Vim shell_date.sh

Then, a CGI program with the same functionality is written in C language:

Vim c_date.c

The program output is as follows:

In this way, a simple CGI program for displaying time is completed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.