• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 28. Programming CGI Scripts > Beyond XHTML with CGI

Beyond XHTML with CGI

When you invoke a URL that points to a CGI program, the HTTP server starts the program. The server then sends back the program's output as if it were the contents of an XHTML file. What does this accomplish? For one thing, a CGI program can read and write data files (a Web server can only read them) and produce different results each time you run it. This is how page counters work. Each time the page counter is called, it finds the previous count from information stored on the server (usually in a file), increments it by one, and creates either a text- or image-based representation of the new count as its output. The server sends the data back to the browser just as if it were a real file living somewhere on the server. Thus, you can use a CGI program to dynamically create XHTML code at the time it is requested, rather than having all your content in static files that are the same each time they are served.

NCSA Software Development maintains the CGI specification. You'll find the specification at the World Wide Web Consortium's CGI pages: http://www.w3.org/CGI/. This document goes into great detail, including history, rationales, and implications. If you don't already have a copy, download one and keep it handy. You won't need it to understand the examples in this book, but it will give you a solid overview of CGI and help you think through your own projects in the future.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint