Understanding the Common Gateway Interface (CGI) - Part 1

Graphical web browsers first appeared around 1993, and for a while people were content to view static pages, which always displayed the same content each time the page was displayed. Gradually though, people began to expect more from their web experience and one of the results of this was the arrival of dynamic pages.

Nowadays there are plenty of technologies and languages that allow the user of a browser to execute a program on the web server, and to thereby receive dynamic, as well as static, content. However, the first to offer this capability was the Common Gateway Interface (CGI) technology.

Browsing Web Pages

The web is basically two systems trying to exchange data with each other: the client (browser) on one side who is normally trying to get data, and the web server on the other side who is normally sending data to the client.

The client makes a request for a page, and then the server tries to fetch that page from a hard disk and send it to the client.

The Uniform Resource Locator (URL)

To request a web page a client uses a Uniform Resource Locator (URL), for example, www.efghij.com/introduction.htm.

  • http is the usual protocol (set of rules) used for transferring web pages. It means Hypertext Transfer Protocol. A couple of other protocols that you will often come across are https, which means secure http, and ftp, which means File Transfer Protocol.
  • www.efghij.com is the hostname. This is the name of the web server and is sometimes written as an Internet Protocol (IP) address, for example, 123.617.934.321. efghij.com is also known as the domain name.
  • introduction.htm is the file (web page) on the server to be retrieved.

If the page exists, it is sent from the server to the client; if it doesn’t, a ‘missing page’ error message is displayed in the web browser.

Dynamic Web Pages

When sending a static web page, the server ’simply’ needs to locate the required page and then send it to the browser (of course, in reality, this isn’t simple at all!).

Sometimes though, this is not enough, and the web server needs to send dynamically-generated content to the browser. A typical example of this is when data is extracted from a database based on some search criteria entered into the browser. The reason pages like this are known as dynamic pages is because much of the content displayed on the resultant web page will be different each time the page is sent to the browser. In other words, different searches will generate different content for the page.

About the Author: John Dixon is a web developer working through his own company www.dixondevelopment.co.ukJohn Dixon Technology Limited. The company also develops and supplies a free www.dixondevelopment.co.uk/earningstracker.htmaccounting and bookkeeping software tool called Earnings Tracker. The company’s web site contains various articles, tutorials, news feeds, and a finance and business blog.

SocialTwist Tell-a-Friend
Cool site: http://trishaz.blogpico.com :sent by ur frnd

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image