ABCs of CGI Interactive Web pages, like the ones that ask visitors to fill out a form, may use the Common Gateway Interface (CGI) to send the form's data to the server. For example, a car-buyer's Web site could be using CGI when it displays a query screen to capture requested information such as desired car model and price range. Behind the scenes, a request for an inexpensive sports car travels to the server, according to the CGI rules. A CGI script then searches the database for the pertinent information, and the results are placed on an HTML page and sent back to the browser. This ability to create a page on the fly, based on input from the user, is one of the main reasons Web developers love CGI. Although you will hear the phrase "CGI script," CGI is not a language. Rather, it's a set of protocols that defines how a client and a server exchange data. A CGI script is an implementation of that protocol and can be written in any of several programming languages. The most common scripting language is Perl, although a developer can use C, C++, REXX and Basic-as well as other languages-to write CGI scripts. Despite site creators' early acceptance of CGI, many ISPs prohibited CGI's use within sites they hosted, fearing that poorly written scripts would disrupt their Web servers. These days the ban has eased, but developers should check with their hosting service before committing to CGI. Eventually, CGI may be eclipsed by other ways of creating interactive Web pages and produce faster applications. The leading contenders to unseat CGI are NSAPI and ISAPI, the application programming interfaces supported by Netscape and Microsoft's widely used Web servers. |