CGI programming on the World Wide Web by Shishir Gundavaram

By Shishir Gundavaram

The realm broad internet is greater than a spot to place up smart files and beautiful photographs. utilizing the typical Gateway Interface (CGI), you could supply interactive queries and serve immediate details from databases, labored up into colourful snap shots. This ebook bargains a complete rationalization of CGI and comparable recommendations for those who carry directly to the dream of offering their very own info servers on the net. the writer begins firstly, explaining the price of CGI and the way it really works, then strikes speedily into the sophisticated information of programming. the vast majority of examples use the most typical platform (UNIX) and the most well-liked language (Perl) used for CGI programming this day. although, the booklet additionally introduces the necessities of making CGI paintings with different systems and languages.

Show description

Read or Download CGI programming on the World Wide Web PDF

Similar data in the enterprise books

Common Design Patterns for Symbian OS: The Foundations of Smartphone Software (Symbian Press)

Universal layout styles for Symbian OS is the 1st layout styles publication that addresses Symbian OS in particular. It introduces programmers to the typical layout styles that support enforce a wide number of purposes and providers on Symbian OS. The aim of the booklet is to supply the event of Symbian's builders to a much broader viewers and let subtle courses to be fast written and to a excessive common.

The Definitive Guide to the ARM Cortex-M0

It truly is a thrilling time to be a microcontroller consumer. A becoming diversity of ARM Cortex-M units can be found from many owners, spanning a vast diversity of functions. clients who're conversant in 8-bit and 16-bit microcontrollers and are relocating to ARM Cortex-Mebased units are stunned at simply how effortless they're to take advantage of and, with the advent of ARM Cortex-M0 units, how inexpensive and effective 32-bit microcontrollers became.

Additional resources for CGI programming on the World Wide Web

Sample text

You are not limited to using a CGI program on your server to decode form information; you can specify a URL of a remote host if a program that does what you want is available elsewhere. The METHOD attribute specifies how the server will send the form information to the program. POST sends the data through standard input, while GET passes the information through environment variables. If no method is specified, the server defaults to GET. Both methods have their own advantages and disadvantages, which will be covered in detail later in the chapter.

To perform server redirection, you need to send a Location header to tell the server what document to send. 1). 1: Server redirection [Graphic: Figure 3-1] A common use for this feature is to return a generic document that contains static information. For example, say you have a form for users to fill out, and you want to display a thank-you message after someone completes the form. You can have the CGI program create and display the message each time it is called. But a more efficient way would be for the program to send instructions to the server to redirect and retrieve a file that contains a generic thank-you message.

This extension allows you to use the associative array %ENV to access the various environment variables in MacPerl. 8 Examining Environment Variables What would the chapter be without a program that displays some of the commonly used environment variables? /usr/local/bin/perl %list = ('SERVER_SOFTWARE', 'The server software is: ', 'SERVER_NAME', 'The server hostname, DNS alias, or IP address is: ', 'GATEWAY_INTERFACE', 'The CGI specification revision is: ', 'SERVER_PROTOCOL', 'The name and revision of info protocol is: ', 'SERVER_PORT', 'The port number for the server is: ', 'REQUEST_METHOD', 'The info request method is: ', 'PATH_INFO', 'The extra path info is: ', 'PATH_TRANSLATED', 'The translated PATH_INFO is: ', 'DOCUMENT_ROOT', 'The server document root directory is: ', 'SCRIPT_NAME', 'The script name is: ', 'QUERY_STRING', 'The query string is (FORM GET): ', 'REMOTE_HOST', 'The hostname making the request is: ', 'REMOTE_ADDR', 'The IP address of the remote host is: ', 'AUTH_TYPE', 'The authentication method is: ', 'REMOTE_USER', 'The authenticated user is: ', 'REMOTE_IDENT', 'The remote user is (RFC 931): ', 'CONTENT_TYPE', 'The content type of the data is (POST, PUT): ', 'CONTENT_LENGTH', 'The length of the content is: ', 'HTTP_ACCEPT', 'The MIME types that the client will accept are: ', 'HTTP_USER_AGENT', 'The browser of the client is: ', 'HTTP_REFERER', 'The URL of the referer is: '); print "Content-type: text/html","\n\n"; print "", "\n"; print "List of Environment Variables", "\n"; print "", "\n"; print "

", "CGI Environment Variables", "

", "
", "\n"; while ( ($env_var, $info) = each %list ) { print $info, "", $ENV{$env_var}, "", "
","\n"; } print "
", "\n"; print "", "", "\n"; exit (0); The associative array contains each environment variable and its description.

Download PDF sample

Rated 4.48 of 5 – based on 13 votes

admin