common gateway interface (CGI) scripting. Basic CGI scripts include the ability to display the current time or the number of users who have accessed a server. More advanced and useful CGI scripts allow readers to search databases, complete survey forms and have them sent to an email address, implement imagemaps, or take pictures of remote places and have the pictures returned.
CGI scripts are made available to a Web browser through the use of simple links, specialized URLs containing a question marks (?), ISINDEX HTML tags, or HTML+ FORMs. After the user submits an HTML document containing one of these elements, a query is passed to the HTTP server, which is passed on to the CGI script itself. The script processes the input, formats the output into HTTP codes and/or an HTML document, and returns these items back to the HTTP server. The server then passes it along to the client application.
CGI scripts can be written in almost any language. Common languages include C, Perl, AppleScript, VisualBasic, and Unix shell scripts. This section outlines how to write simple CGI scripts using Perl. Perl is freely distributed, runs on just about any computing platform, includes functions for doing TCP communications, and has complete string manipulation functions. Most importantly, Perl is has one of the best support groups available anywhere, the Internet.
Keep in mind that Perl may not be the best CGI scripting language for your particular need. It is always a good idea to use the best tool for your particular job and other scripting languages may provide more useful hooks to your server's operating system.
- "Overview of CGI" - "This page contains pointers to information and resources on the Common Gateway Interface, a standard for the interface between external gateway programs and information servers." <URL:http:// www.w3.org/hypertext/WWW/CGI/Overview.html>
- "FastCGI" - FastCGI is a new, open extension to CGI that provides high performance for all Internet applications without any of the limitations of existing Web server APIs. <URL:http:// www.fastcgi.com/>
- "Perl Language Home Page" - This is the offical home page for Perl <URL:http:// www.perl.com/perl/>
- "[Perl Ports]" - This will take you to a randomly chosen FTP site hosting the Macintosh and Windows-based ported versions of Perl. <URL:http:// www.perl.com/CPAN/ports/>
- O'Reilly & Associates, Inc., "Software Library - Extras" - Here is a set of CGI resources specicically for WebSite. <URL:http:// software.ora.com/techsupport/software/extras.html>
- Chuck Shotton, "Using FileMaker Pro with MacHTTP" - An archive with sample forms and CGI that shows how to hook MacHTTP to FMPro. <URL:http:// www.biap.com/machttp/examples/fmpro.sit.hqx>
- Chuck Shotton, "Writing Search Engines for MacHTTP " - This points to an archive containing C source code for a sample application that performs searches in conjunction with MacHTTP using the "srch" AppleEvent. <URL:http:// www.biap.com/machttp/ftp/search_ex.sit.hqx>
- Danny Goodman, Complete AppleScript Handbook (Random House: New York, 1994)
- Dave Winer, "Frontier Community Center" - "Frontier is a scripting system for the Macintosh. Lots of features, lots of verbs. It used to be a commercial product, but now it's free. Why? Because I want Frontier to have a shot at becoming a standard. I think it'll be fun!" <URL:http:// www.scripting.com/frontier/>
- Derrick Schneider, Tao of AppleScript (Hayden Books: Carmel, IN, 1993)
- Gisle Aas, "LIBWWW-PERL-5" - "The libwww-perl distribution is a collection of Perl modules which provides a simple and consistent programming interface (API) to the World-Wide Web. The main focus of the library is to provide classes and functions that allow you to write WWW clients, thus libwww-perl said to be a WWW client library. The library also contain modules that are of more general use." <URL:http:// www.sn.no/libwww-perl/>
- John G. Cope, "Win-httpd CGI-DOS" - Here is a wrapper for Perl scripts written for DOS/Windows machines. <URL:http:// www.achilles.net/~john/cgi-dos/>
- Lincoln D. Stein, "CGI.pm" - This is Perl 5 module for creating and processing HTML+ forms. <URL:http:// www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html>
- Lincoln D. Stein, "CGI::* Modules for Perl5" - Here is a collection of Perl libraries for creating Perl-based CGI scripts. <URL:http:// www.genome.wi.mit.edu/WWW/tools/scripting/CGIperl/>
- Matt Wright, "Matt's Script Archive" - A collection of Perl scripts as well as lists of other Perl script collections. <URL:http:// worldwidemart.com/scripts/>
- Matthias Neeracher, "MacPerl and PCGI" - This points to the FTP archive for MacPerl and PCGI, a script inserting the necessary resources into a MacPerl script so it can be executed as a CGI script. <URL:ftp://err.ethz.ch/pub/neeri/MacPerl/>
- Meng Weng Wong, "Index of Perl/HTML archives" - "This is a list of Perl scripts and archives involving HTML." <URL:http:// www.seas.upenn.edu/~mengwong/perlhtml.html>
- NCSA, "Common Gateway Interface" - This is the official specification for CGI scripting. <URL:http:// hoohoo.ncsa.uiuc.edu/cgi/intro.html>
- NCSA, "Mosaic for X version 2.0 Fill-Out Form Support" - This is the original specification for what was then called HTML+ FORMS. <URL:http:// www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/fill-out-forms/overview.html>
- Robert Godwin-Jones, "Guide to Web Forms and CGI Scripts for Language Learning" <URL:http:// www.fln.vcu.edu/cgi/interact.html>
- Roy Fielding, "WWW Protocol Library for Perl" - "libwww-perl is a library of Perl packages/modules which provides a simple and consistent programming interface to the World Wide Web. This library is being developed as a collaborative effort to assist the further development of useful WWW clients and tools." <URL:http:// www.ics.uci.edu/pub/websoft/libwww-perl/>
- Sandra Silcot, "MacPerl Primer" - "This Primer is intended to assist new users get started with Macintosh Perl, and to point out salient differences for experienced Unix Perlers. This Primer is not a language reference manual, nor does it replace Matthias's documentation or Hal Wine's Frequently Asked Questions (FAQ) about MacPerl. The primer assumes you have already obtained and installed MacPerl, and that you have read the MacPerl FAQ." <URL:http:// www.unimelb.edu.au/~ssilcot/macperl-primer/home.html>
- Selena Sol, "Selena Sol's Public Domain CGI Script Archive and Resource List" - "n the following pages we have included both working examples of our scripts as well as the text of the code so that you can have one window open with the code and the other with the working script. Hopefully this design will help you figure out how we did what we did, so that you can take the ideas and run with them for your own needs." <URL:http:// www.eff.org/~erict/Scripts/>
- Selena Sol, "Selena Sol's Public Domain CGI Script Archive and Resource Library" - This is a very useful collection of free Perl scripts and libraries for use on our HTTP server. <URL:http:// www.eff.org/~erict/Scripts/>
- StarNINE, "Extending WebSTAR" - This is an extensive list of scripts and "plug-ins" for WebSTAR. <URL:http:// www.starnine.com/development/extendingwebstar.html>
- Steven E. Brenner, "cgi-lib.pl Home Page" - Here is a long list of Perl instruction books as well as documentation for cgi-lib.pl, a very popular Perl library for processing the input of HTML+ forms. <URL:http:// www.bio.cam.ac.uk/cgi-lib/>
- Yahoo!, "Gateways (Yahoo!)" - A collection on searching gateway scripts, as well as a number of CGI examples are found here. <URL:http:// www.yahoo.com/Computers/World_Wide_Web/Gateways/>
- Yahoo!, "CGI - Common Gateway Interface (Yahoo!)" - A large collection of CGI scripts. <URL:http:// www.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/ CGI___Common_Gateway_Interface/>
Previous | Top | Next | Search | Comments
Last updated: 2004/12/23. See the release notes.
Author: Eric Lease Morgan (email@example.com)