126 lines
8.2 KiB
HTML
126 lines
8.2 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
|||
|
<!DOCTYPE html
|
|||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|||
|
<html lang="en-us" xml:lang="en-us">
|
|||
|
<head>
|
|||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|||
|
<meta name="security" content="public" />
|
|||
|
<meta name="Robots" content="index,follow" />
|
|||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|||
|
<meta name="DC.Type" content="topic" />
|
|||
|
<meta name="DC.Title" content="Common gateway interface (CGI) programs for the HTTP Server" />
|
|||
|
<meta name="DC.Relation" scheme="URI" content="rzaieparcgi.htm" />
|
|||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2002,2006" />
|
|||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2002,2006" />
|
|||
|
<meta name="DC.Format" content="XHTML" />
|
|||
|
<meta name="DC.Identifier" content="rzaieprogcgi" />
|
|||
|
<meta name="DC.Language" content="en-us" />
|
|||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|||
|
<!-- US Government Users Restricted Rights -->
|
|||
|
<!-- Use, duplication or disclosure restricted by -->
|
|||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|||
|
<title>Common gateway interface (CGI) programs for the HTTP Server</title>
|
|||
|
</head>
|
|||
|
<body id="rzaieprogcgi"><a name="rzaieprogcgi"><!-- --></a>
|
|||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|||
|
<h1 class="topictitle1">Common gateway interface (CGI) programs for the HTTP Server</h1>
|
|||
|
<div><div class="important"><span class="importanttitle">Important:</span> Information
|
|||
|
for this topic supports the latest PTF levels for HTTP Server for i5/OS .
|
|||
|
It is recommended that you install the latest PTFs to upgrade to the latest
|
|||
|
level of the HTTP Server for i5/OS. Some of the topics documented here are
|
|||
|
not available prior to this update. See <a href="http://www-03.ibm.com/servers/eserver/iseries/software/http/services/service.html" target="_blank">http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm</a> <img src="www.gif" alt="Link outside Information Center" /> for more information. </div>
|
|||
|
<p>Common Gateway Interface (CGI) is a standard that defines how information
|
|||
|
is exchanged between a Web server and an external program (CGI program). </p>
|
|||
|
<p>The functions and tasks that CGI programs can perform range from the simple
|
|||
|
to the very advanced and come in two different types, GGI script and gateway
|
|||
|
program. CGI scripts are used to perform simple tasks and do not require to
|
|||
|
be compiled. The more complex tasks are most commonly referred to as gateway
|
|||
|
programs. In general, both types are referred to as CGI programs.</p>
|
|||
|
<p>Regardless of the type of CGI program, both are designed to handle dynamic
|
|||
|
information. Dynamic, in this context, refers to temporary information that
|
|||
|
is created for a one-time use and not stored as a static Web page. This information
|
|||
|
may be a document, an e-mail message, or the results of a conversion program.
|
|||
|
You must compile gateway programs before using them. Compiled programs typically
|
|||
|
run faster than programs that are written in scripting languages. On the other
|
|||
|
hand, those programs that are written in scripting languages tend to be easier
|
|||
|
to write, maintain, and debug.</p>
|
|||
|
<p>The CGI specification dictates how CGI programs receive input and how output
|
|||
|
is produced. A common use of CGI programs is to process data that is received
|
|||
|
from browser clients. For example, the client fills out a form and sends the
|
|||
|
information back to the server. Then the server runs the CGI program. Programs
|
|||
|
that are called by the server must conform to the server CGI interface in
|
|||
|
order to run properly.</p>
|
|||
|
<p>The administrator controls which CGI programs the system can run by using
|
|||
|
the server directives. The server recognizes a URL that contains a request
|
|||
|
for a CGI program, commonly called a CGI script. Depending on the server directives,
|
|||
|
the server calls that program on behalf of the client browser. The server
|
|||
|
supports CGI programs that are written in C++, REXX, ILE C, ILE RPG, and ILE
|
|||
|
COBOL. It also supports multi-thread CGI programs in all of these languages
|
|||
|
capable of multiple threads. </p>
|
|||
|
<p>For detailed information about CGI APIs, see <a href="rzaierefapi.htm">Application programming interfaces (APIs) for HTTP Server</a>.</p>
|
|||
|
<div class="section" id="rzaieprogcgi__cgidynamicdoc"><a name="rzaieprogcgi__cgidynamicdoc"><!-- --></a><h4 class="sectiontitle">CGI and dynamic documents</h4><p>There
|
|||
|
are many types of files that exist on the Web. Primarily they fall into one
|
|||
|
of the following catagories:</p>
|
|||
|
<ul><li>images</li>
|
|||
|
<li>multimedia</li>
|
|||
|
<li>programs</li>
|
|||
|
<li>HTML documents</li>
|
|||
|
</ul>
|
|||
|
<p>Servers break HTML documents into two distinct types:</p>
|
|||
|
<ul><li>static</li>
|
|||
|
<li>dynamic</li>
|
|||
|
</ul>
|
|||
|
<p><em>Static documents</em> exist in non-changing source form on the web
|
|||
|
server. You should create <em>Dynamic documents</em> as temporary documents
|
|||
|
to satisfy a specific, individual request. </p>
|
|||
|
<p>Consider the process of
|
|||
|
″serving″ these two types of documents. Responding to requests for static
|
|||
|
documents is fairly simple. For example, Jill User accesses the Acme web server
|
|||
|
to get information on the Pro-Expert gas grill. She clicks on Products, then
|
|||
|
on Grills, and finally on Pro-Expert. Each time Jill clicks on a link, the
|
|||
|
web browser uses the URL that is attached to the link to request a specific
|
|||
|
document from the web server. The server responds by sending a copy of the
|
|||
|
document to Jill’s browser. </p>
|
|||
|
<p>What if Jill decides that she wants to
|
|||
|
search through the information on the Acme web server for all documents that
|
|||
|
contain information on Acme grills? Such information could consist of news
|
|||
|
articles, press releases, price listings, and service agreements. This is
|
|||
|
a more difficult request to process. This is not a request for an existing
|
|||
|
document. Instead, it is a request for a dynamically generated list of documents
|
|||
|
that meet certain criteria. This is where CGI comes in. </p>
|
|||
|
<p>CGI programs
|
|||
|
may be used to parse the request and search through the documents on your
|
|||
|
web server. You can also use it to create a list with hypertext links to each
|
|||
|
of the documents that contain the specified word or string.</p>
|
|||
|
</div>
|
|||
|
<div class="section" id="rzaieprogcgi__usesofcgi"><a name="rzaieprogcgi__usesofcgi"><!-- --></a><h4 class="sectiontitle">Uses for CGI</h4><p>HTML allows you to access
|
|||
|
resources on the Internet by using other protocols that are specified in the
|
|||
|
URL. Examples of such protocols are mailto, ftp, and news. If you code a link
|
|||
|
with mailto that is followed by an e-mail address, the link will result in
|
|||
|
a generic mail form. </p>
|
|||
|
<p>What if you wanted your customers to provide specific
|
|||
|
information, such as how often they use the web? Or how they heard about your
|
|||
|
company? Rather than using the generic mailto form, you can create a form
|
|||
|
that asks these questions and more. You can then use a CGI program to interpret
|
|||
|
the information, include it in an e-mail message, and send it to the appropriate
|
|||
|
person. </p>
|
|||
|
<p>You do not need to limit CGI programs to processing search
|
|||
|
requests and e-mail. You can use them for a wide variety of purposes. Basically,
|
|||
|
anytime you want to take input from the reader and generate a response, you
|
|||
|
can use a CGI program. The input may even be apparent to the reader. For example,
|
|||
|
many people want to know how many other people have visited their home page.
|
|||
|
You can create a CGI program that keeps track of the number of requests for
|
|||
|
your home page. This program can display the new total each time someone links
|
|||
|
to your home page.</p>
|
|||
|
</div>
|
|||
|
<p>For general information on CGI programs see <a href="http://hoohoo.ncsa.uiuc.edu/cgi/" target="_blank">http://hoohoo.ncsa.uiuc.edu/cgi/</a> <img src="www.gif" alt="Link outside Information Center" />. </p>
|
|||
|
</div>
|
|||
|
<div>
|
|||
|
<div class="familylinks">
|
|||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaieparcgi.htm" title="This topic provides information about Common Gateway Interfaces (CGI).">Common Gateway Interface</a></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|