CGI Scripting
CGI stands for Common Gateway Interface, which is the standard for creating dynamic files or web pages. It can be seen in use on thousands of web pages – website guest books which allow a visitor to enter a message which is displayed the next time anyone accesses the guest page, or search engine pages where one types in a query and the search engine responds by displaying the results pages.
CGI scripting actually refers to writing a program that will control how a website’s content can be displayed to visitors.
Basics of CGI Scripting
In CGI scripting, one has to remember the basic mode of web communications – the client-server mode. To access a web page, a client computer communicates with a server computer then it accesses the file and downloads it. The website and all its elements (data, graphics, etc.) are kept on the server, which sends the information to a client computer anytime the latter seeks it out.
A query from a client computer goes to the server. The server reviews the request, pinpoints the file needed, retrieves it, and forwards this to the client. This is basically how web servers handle static files or files that exist in a constant state.
However, a website owner may want a request to the server to go through several steps before being granted access to a static file. He may want the person looking for the file to become a paid member of the website or he may wish to find out some statistics about the user (e.g. age, gender, nationality, how he found out about the site); etc before access to the file is granted.
This requires an executable program which directs the server to implement the various steps that the webmaster wants the user to follow. This is where CGI scripting comes in.
Key Requirements for CGI Scripting
The most important thing to remember is that CGI requires an understanding and knowledge of a programming language (C, Fortran, etc.) or a scripting language like PERL or a Unix shell. It is not necessary to get formal training to learn the language; there are websites which offer free C or PERL scripts that can be adapted to one’s specific needs or requirements. However, programming a script requires logic – in effect, one must be able to break down what he wants to happen step by step so that the script can be executed flawlessly.
As such, it would be best to learn a programming or scripting language rather than relying on ready-made scripts that one adapts to his needs. For one, knowing the language and how a script is put together gives a person the flexibility to design his own program and generate the information he needs.
Learning CGI scripting may be difficult, especially as it requires learning a new language and applying critical thinking and logic to writing the script. This knowledge is important, however, if one wishes to be able to come up with a dynamic web page.
Comments - No Responses to “CGI Scripting”
Sorry but comments are closed at this time.