The Common Gateway Interface (CGI) is a standard protocol for enabling applications (commonly called CGI programs or CGI scripts) to interact with Web servers and (indirectly) with clients (e.g., Web browsers). CGI is often used to generate dynamic Web content using client input, databases and other information services. A Web page is dynamic if its content is generated programmatically when the page is requested, unlike static Web content, which is not generated programmatically when the page is requested (i.e., the page already exists before the request is made). For example, we can use a static Web page to ask a user to input a ZIP code, then redirect the user to a CGI script that generates a dynamic Web page customized for people in that geographical area. In this chapter, we introduce the basics of CGI and use C++ to write our first CGI scripts.
The Common Gateway Interface is "common" in the sense that it is not specific to any particular operating system (such as Linux or Windows) or to any one programming language. CGI was designed to be used with virtually any programming language, such as C, C++, Perl, Python or Visual Basic.
CGI was developed in 1993 by NCSA (National Center for Supercomputing Applicationswww.ncsa.uiuc.edu) for use with its popular HTTPd Web server. Unlike Web protocols and languages that have formal specifications, the initial concise description of CGI written by NCSA proved simple enough that CGI was adopted as an unofficial standard worldwide. CGI support was incorporated quickly into other Web servers, including Apache.
Introduction to Computers, the Internet and World Wide Web
Introduction to C++ Programming
Introduction to Classes and Objects
Control Statements: Part 1
Control Statements: Part 2
Functions and an Introduction to Recursion
Arrays and Vectors
Pointers and Pointer-Based Strings
Classes: A Deeper Look, Part 1
Classes: A Deeper Look, Part 2
Operator Overloading; String and Array Objects
Object-Oriented Programming: Inheritance
Object-Oriented Programming: Polymorphism
Templates
Stream Input/Output
Exception Handling
File Processing
Class string and String Stream Processing
Web Programming
Searching and Sorting
Data Structures
Bits, Characters, C-Strings and structs
Standard Template Library (STL)
Other Topics
Appendix A. Operator Precedence and Associativity Chart
Appendix B. ASCII Character Set
Appendix C. Fundamental Types
Appendix D. Number Systems
Appendix E. C Legacy Code Topics
Appendix F. Preprocessor
Appendix G. ATM Case Study Code
Appendix H. UML 2: Additional Diagram Types
Appendix I. C++ Internet and Web Resources
Appendix J. Introduction to XHTML
Appendix K. XHTML Special Characters
Appendix L. Using the Visual Studio .NET Debugger
Appendix M. Using the GNU C++ Debugger
Bibliography