Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> HTML >> Snippet

20 CGI


..Small web sites create static web pages and place them on a web site for
viewing by visitors.

But large sites, with frequently changing information, typically create web
pages on demand - they don't exist until the user asks for them.  The pages
are created by running a program on the computer which runs the HTTP
servers.  The newly created web page is handed off to the HTTP program,
which in turn send it to the visitor who requested the information.

Creating information on demand and returning it to the user as a web page is the
common approach for all large, commercial web sites.  Called 'dynamic HTML', the
web page creation is done by computer programs which reside on the computer
that is also running the HTTP server.

CGI (Common Gateway Interface) is a specification which defines how the handoff
will occur between the server and the program that creates the dynamic HTML
pages.

Whether you use Windows or UNIX servers, the principal is the same.  The
user runs a browser which asks the server (using HTTP) to send a page.
The server sends the page if it exists or generates it on the fly using a program
which creates the requested file and hands it over to the server, while observing
the CGI rules.

The secondary programs, those which create the dynamic HTML pages,
can be standard compiled programs, where the EXE is called into play for
creating the web pages.

It is very common, however, to write such programs using 'scripting' languages.
Scripting languages are text files which are compiled or interpreted at the moment
they are used.  Perl and ASP are examples of such scripting programs.

Scripting programs are stored as simple text files which get transferred to the
server.  You'll hear these programs written as 'CGI Scripts', but strictly speaking
the CGI is the specification that defines how the scripting language will turn over
its output to the HTTP server for return to the requesting site visitor.