You are previewing CGI Programming on the World Wide Web.
O'Reilly logo
CGI Programming on the World Wide Web

Book Description

The World Wide Web is more than a place to put up clever documents and pretty pictures. With a little study and practice, you can offer interactive queries and serve instant information from databases, worked up into colorful graphics. That is what the Common Gateway Interface (CGI) offers.

This book offers a comprehensive explanation of CGI and related techniques for people who hold on to the dream of providing their own information servers on the Web.

Good scripting is not limited to a knowledge of CGI -- you need to know something about other programming tools that organize data and make the output look attractive. Gundavaram starts at the beginning, explaining the value of CGI and how it works, and takes you swiftly into the subtle details of programming. The book offers a comprehensive look at the job of providing information dynamically on the Web.

For most of the examples, this book uses the most common platform (UNIX) and the most popular language (Perl) used for CGI programming today. However, it also introduces the essentials of making CGI work with other platforms and languages. The actual programming techniques are not too different from one platform and language to another; the lessons from this book can be applied to any tools you choose.

Topics include:

  • Basic Perl techniques for parsing and output

  • Embedding Server Side Includes (SSI)

  • Graphics and simple animation

  • Forms and magic cookies

  • Gateways and SQL processing

  • Internet communications

  • Examples of games, imagemap manipulation, and other advanced applications

  • Table of Contents

    1. Cover Page
    2. Title Page
    3. Contents
    4. Preface
      1. What's in the Book
    5. 1. The Common Gateway Interface (CGI)
      1. 1.1 What Is CGI?
      2. 1.2 CGI Applications
      3. 1.3 Some Working CGI Applications
      4. 1.4 Internal Workings of CGI
      5. 1.5 Configuring the Server
      6. 1.6 Programming in CGI
      7. 1.7 CGI Considerations
      8. 1.8 Overview of the Book
    6. 2. Input to the Common Gateway Interface
      1. 2.1 Introduction
      2. 2.2 Using Environment Variables
      3. 2.3 Accessing Form Input
      4. 2.4 Extra Path Information
      5. 2.5 Other Languages Under UNIX
      6. 2.6 Other Languages Under Microsoft Windows
      7. 2.7 Other Languages on Macintosh Servers
      8. 2.8 Examining Environment Variables
    7. 3. Output from the Common Gateway Interface
      1. 3.1 Overview
      2. 3.2 CGI and Response Headers
      3. 3.3 Accept Types and Content Types
      4. 3.4 The Content-length Header
      5. 3.5 Server Redirection
      6. 3.6 The “Expires” and “Pragma” Headers
      7. 3.7 Status Codes
      8. 3.8 Complete (Non-Parsed) Headers
    8. 4. Forms and CGI
      1. 4.1 HTML Tags
      2. 4.2 Sending Data to the Server
      3. 4.3 Designing Applications Using Forms in Perl
      4. 4.4 Decoding Forms in Other Languages
    9. 5. Server Side Includes
      1. 5.1 Introduction
      2. 5.2 Configuration
      3. 5.3 Environment Variables
      4. 5.4 Including Boilerplates
      5. 5.5 File Statistics
      6. 5.6 Executing External Programs
      7. 5.7 Executing CGI Programs
      8. 5.8 Tailoring SSI Output
      9. 5.9 Common Errors
    10. 6. Hypermedia Documents
      1. 6.1 Creating Dynamic Home Pages
      2. 6.2 CGI Examples with PostScript
      3. 6.3 The gd Graphics Library
      4. 6.4 CGI Examples with gnuplot
      5. 6.5 CGI Examples with pgperl
      6. 6.6 Animation
    11. 7. Advanced Form Applications
      1. 7.1 Guestbook
      2. 7.2 Survey/Poll and Pie Graphs
      3. 7.3 Quiz/Test Form Application
      4. 7.4 Security
    12. 8. Multiple Form Interaction
      1. 8.1 Hidden Fields
      2. 8.2 CGI Side Includes
      3. 8.3 Netscape Persistent Cookies
    13. 9. Gateways, Databases, and Search/Index Utilities
      1. 9.1 UNIX Manual Page Gateway
      2. 9.2 Mail Gateway
      3. 9.3 Relational Databases
      4. 9.4 Search/Index Gateway
    14. 10. Gateways to Internet Information Servers
      1. 10.1 Overview
      2. 10.2 What Are Sockets?
      3. 10.3 Socket I/O in Perl
      4. 10.4 Socket Library
      5. 10.5 Checking Hypertext (HTTP) Links
      6. 10.6 Archie
      7. 10.7 Network News on the Web
      8. 10.8 Magic Cookies
      9. 10.9 Maintaining State with a Server
      10. 10.10 Forking/Spawning Child Processes
    15. 11. Advanced and Creative CGI Applications
      1. 11.1 Animated Clock
      2. 11.2 Game of Concentration
      3. 11.3 Introduction to Imagemaps
      4. 11.4 Calendar Manager
    16. 12. Debugging and Testing CGI Applications
      1. 12.1 Common Errors
      2. 12.2 Programming/System Errors
      3. 12.3 Environment Variables
      4. 12.4 Logging and Simulation
      5. 12.5 CGI Lint--A Debugging/Testing Tool
      6. 12.6 Set UID/GID Wrapper
    17. A. Perl CGI Programming FAQ
      1. A.1 Introduction
      2. A.2 Modules
      3. A.3 CGI and the WWW Server
      4. A.4 Specific Programming Questions
      5. A.5 Security
    18. B. Summary of Regular Expressions
    19. C. CGI Modules for Perl 5
      1. C.1 Overview of Modules
      2. C.2 Form Creation and Parsing
    20. D. CGI Lite
      1. D.1 Multipart Forms
    21. E. Applications, Modules, Utilities, and Documentation
      1. E.1 Software Developed for the Book
      2. E.2 CGI Software
      3. E.3 Utilities and Applications
      4. E.4 WWW Server Information
      5. E.5 Online Documentation
      6. E.6 Official Specifications
    22. Symbols and Numbers