Home | Contact Us | Log In | Help
HOME NEW LISTING MOST POPULAR HIGHEST RATED SCRIPTS ADD SCRIPT DOWNLOADS FORUM
Tutorials
  ASP.Net & C#
  ASP
  Perl and PHP
  Java Scripts
  C and C++
  Ajax Tutorials
  J2ee, J2Me, Java
  Python & Ruby Rail
  Crystal Report
  Sap
  CGI
  XML
  Cold Fusion & CFML
  HTML, DHTML & CSS
  Dreamweaver
  FLASH
  Photoshop/Web Designing
  Tools & Utilities
  Oracle/D2K
  Sql Server
  MySql
  Domain Name Registration
  Remotely Hosting
  Web/Server Application
  Hotel Marketing
  Internet and Law
   Search Engine Optimization/SEO
E-Commerce
Interview Questions
Previous < 5 6 7 8 9 10 >Next
CGI 9

Common Gateway Interface


<World-Wide Web> (CGI) A standard for running external programs from a World-Wide Web HTTP server. CGI specifies how to pass arguments to the program as part of the HTTP request. It also defines a set of environment variables that are made available to the program. The program generates output, typically HTML, which the web server processes and passes back to the browser. Alternatively, the program can request URL redirection. CGI allows the returned output to depend in any arbitrary way on the request.


The Common Gateway Interface


This is the second article in the CGI/Perl series for the JavaScript No Content Web Site. This article will hopefully de-mystify some of the details concerning exactly how information is passed back and forth from the browser to the server. Like the title says, we are going to talk about passing information back and forth through the Common Gateway Interface. Before we delve into our first example, I feel that it is probably important to mention one of the most important tags in HTML for CGI, and that is the <FORM> tag. Rather than discussing all the different types of form <INPUT> items, I am going to concentrate on two specific attributes of the <FORM> tag - the ACTION attribute and the METHOD attribute.


Debugging Scripts in CGI


If you are programming your script in Perl, the CGI::Carp module can be helpful. However, most other languages[39] you might want to use for CGI do not have anything so useful. If you are programming in a high-level language and want to run a debugger, it is usually impossible to do so directly. However, it is possible to simulate the environment in which an Apache script runs. The first thing to do is to become the user that Apache runs as (often webserv). Then, remember that Apache always runs a script in the script's own directory, so go to that directory. Next, Apache passes most of the information a script needs in environment variables. Determine what those environment variables should be (either by thinking about it or, more reliably, by temporarily replacing your CGI with one that executes env, as illustrated above), and write a little script that sets them, then runs your CGI (possibly under a debugger). Since Apache sets a vast number of environment variables, it is worth knowing that most CGI scripts hardly use any -- usually only QUERY_STRING (or PATH_INFO, less often). Of course, if you wrote the script and all its libraries, you'll know what it used, but that isn't always the case. So, to give a concrete example, suppose we wanted to debug the mycgi script given earlier.

CGI*Star Professional version 5  Features...

  • Generates and installs CGI scripts and online forms automatically.
  • Fully customizable CGI scripts that can be adapted for special requirements.
  • Pre-designed forms generated to match your site.
  • The CGI-generated pages can be customized by using template HTML pages.
  • You can have a working online form and CGI scripts within a few minutes.
  • Uploads and installs the CGI scripts automatically.

Using The Common Gateway Interface (CGI)


Xitami supports CGI programs in Perl, C, or any other language that your system supports. In general, CGI program written for web servers such as Apache and NCSA httpd will run unchanged with Xitami.

A 'CGI' program is considered to be any URL with '/cgi-bin' somewhere in the path name. These are all examples of valid CGI program URLs:

http://localhost/cgi-bin/myprog http://localhost/cgi-bin/myprog.pl http://localhost/products/install/cgi-bin/myprog


Previous < 5 6 7 8 9 10 >Next
  Copyright 2000-2006 © SoloScript.com, All rights reserved.