CHAPTER THREE - CGI ScriptsCGI (Common Gateway Interface) is a standard for running external programs from a Web server. CGI allows the returned HTML page to be dynamic - for example, with a CGI script you could access information in a database and format the results as part of an HTML page. If you're going to create web pages, then at some point you'll want to add a counter, a form to let visitors send you mail or place an order, or something similar. CGI enables you to do that and much more. From mail-forms and counter programs, to the most complex database scripts that generate entire websites on-the-fly, CGI programs deliver a broad spectrum of content on the web today. Not surprisingly, CGI scripts are very popular and used extensively throughout the World Wide Web. A CGI can be written in any programming language, but Perl is the most popular.There are a number of very good introduction to CGI documents available on the Web. The information given below is a summary of the most important points to remember when using CGI. Please refer to the following for a more in-depth introduction:
Key points to bear in mind when using CGI scripts:
CGI is the method by which a web server can obtain data from (or send data to) databases, documents, and other programs, and present that data to viewers via the web. More simply, CGI is programming for the web. Why learn CGI? How do I run my own CGI programs? Put your CGI programs in the cgi-bin directory.
A special note - this does not apply to frontpage webs, follow normal cgi instructions The location of preinstalled scripts is /cgi-sys.
How do I use cgiemail, and Formmail ? CGIemail:This is a program that will email you the forms filled out from the web.
<FORM METHOD=POST ACTION="http://yourdomain.com/cgi-sys/FormMail.pl"> Be sure to replace yourdomain, with your real domain name. Other CGI Questions:"Where do I put my cgi-bin scripts?"Put them in the subdirectory cgi-bin which should be under your public_html directory. You may then call them thru a browser as http://www.yourdomain.com/cgi-bin/your.cgi "I don't have a cgi-bin directory!" Make it by typing mkdir cgi-bin while in your public_html directory. "How do I access cgi-bin scripts in the cgi-bin directory?" If your domain name is bart.com, and the script itself is called your.cgi, access them as http://www.bart.com/cgi-bin/your.cgi. "Hey! /cgi-bin/ doesn't work for me!" Ask us to activate your cgi-bin directory. "I am getting the message 'POST not implemented'. Help!" You probably are using the wrong reference for cgiemail. Another possibility is that you are pointing to a cgi-bin script that you have not put in your cgi-bin directory. In general this message really means that the web server is not recognizing the cgi-bin script you are calling as a program, it thinks it is a regular text file. Additional CGI EMail Info:CGI EMail is a simple, easy-to-use script that takes the results of any form and sends them to you via e-mail. Because it is already installed, minimal configuration is required to successfully use the script. The following steps provide quick summarized instructions for CGI EMail. Be sure to read the CGI user guide for detailed instructions on using CGI EMail. To configure CGI EMail:
|