O’Reilly members suffer live online training, to add books, videos, and also digital contents from 200+ publishers.

You are watching: A programming language typically used for cgi scripts is ____.


1. The common Gateway user interface (CGI)

1.1 What Is CGI?

As girlfriend traverse the huge frontier the the World large Web, you will certainly come throughout documents the make friend wonder, “How walk they do this?” this documents could consist of, amongst other things, creates that ask for feedback or it is registered information, imagemaps that permit you to click various parts of the image, counters that screen the number of users the accessed the document, and utilities that allow you to search databases for certain information. In many cases, you"ll uncover that these impacts were accomplished using the usual Gateway Interface, frequently known as CGI.

One that the Internet"s worst-kept keys is the CGI is unbelievable simple. The is, it"s trivial in design, and also anyone v an iota the programming experience have the right to write rudimentary scripts that work. It"s only as soon as your requirements are much more demanding the you need to master the more facility workings the the Web. In a way, CGI is simple the same method cooking is easy: anyone can toast a muffin or poach an egg. It"s only when you want a Hollandaise sauce that things begin to get complicated.

CGI is the part of the net server that can communicate with other programs to run on the server. V CGI, the web server can call up a program, when passing user-specific data to the program (such as what organize the user is connecting from, or intake the user has actually supplied using HTML form syntax). The regime then processes that data and also the server passes the program"s response ago to the web browser.

CGI isn"t magic; it"s simply programming with some special types of input and also a few strict rule on regime output. Everything in in between is just programming. The course, there are special techniques that are specific to CGI, and also that"s what this publication is largely about. But underlying it every is the an easy model presented in number 1.1.

Figure 1.1: basic diagram the CGI

*

1.2 CGI Applications

CGI transforms the internet from a an easy collection of static hypermedia documents into a whole brand-new interactive medium, in i m sorry users can ask questions and also run applications. Let"s take a look at some of the possible applications that have the right to be designed utilizing CGI.

Forms

One of the most significant uses the CGI is in handling forms. Develops are a subset that HTML that enable the user to supply information. The forms interface makes net browsing an interactive procedure for the user and also the provider. Figure 1.2 shows a an easy form.

Figure 1.2: Simple form illustrating various widgets

*

As can be checked out from the figure, a variety of graphical widgets are easily accessible for form creation, such together radio buttons, message fields, checkboxes, and selection lists. When the type is perfect by the user, the submit Order! switch is supplied to send the info to the server, i m sorry executes the program associated with the particular kind to “decode” the data.

Generally, forms are provided for two key purposes. At their simplest, develops can be provided to collect information from the user. However they can likewise be supplied in a more facility manner to provide back-and-forth interaction. For example, the user have the right to be presented with a kind listing the various documents easily accessible on the server, and an option to search for details information within these documents. A CGI regimen can process this information and also return document(s) that complement the user"s choice criteria.

Chapter 4, Forms and also CGI, discusses creates in detail, and also Chapter 7, Advanced form Applications, shows instances of incorporating develops into several robust applications.

Gateways

Web gateways space programs or scripts offered to access information that is not straight readable through the client. For example, say you have an Oracle database that contains baseball statistics for all the football player on your company team and you would choose to provide this information on the Web. Exactly how would you carry out it? You absolutely cannot allude your customer to the database record (i.e., open up the URL connected with the file) and expect to see any type of meaningful data.

CGI provides a systems to the trouble in the form of a gateway. You can use a language such together oraperl (see thing 9, Gateways, Databases, and Search/Index Utilities, for an ext information) or a DBI expansion to Perl to form SQL queries to review the information had within the database. As soon as you have the information, you have the right to format and send it to the client. In this case, the CGI routine serves together a gateway to the Oracle database, as shown in figure 1.3.

See more: What Was The Marshall Plan Brainly, What Is Marshall Plan​

Figure 1.3: A gateway come a database

*

Similarly, you have the right to write gateway program to any kind of other Internet information service, consisting of Archie, WAIS, and also NNTP (Usenet News). Thing 10, Gateways to Internet info Servers, shows instances of communicating with other web services. In addition, you deserve to amplify the strength of gateways by using the develops interface to inquiry a questions or find string native the user come retrieve and display dynamic, or virtual, information. Us will comment on these special documents next.

Virtual Documents

Virtual, or dynamic, record creation is at the heart of CGI. Virtual files are created on the paris in an answer to a user"s information request. You can create virtual HTML, level text, image, and also even audio documents. A basic example that a virtual file could be something as trivial as this: