#70 Logging Web Events

A cool use of a shell-based CGI script is to log events by using a wrapper. Suppose that I'd like to have a Yahoo! search box on my web page, but rather than feed the queries directly to Yahoo!, I'd like to log them first, to build up a database of what people seek from my site.

First off, a bit of HTML and CGI: Input boxes on web pages are created inside forms, and forms have user information to be processed by sending that information to a remote program specified in the value of the form's action attribute. The Yahoo! query box on any web page can be reduced to the following:

 <form method="get" action="http://search.yahoo.com/bin/search"> Search Yahoo: <input type="text" name="p"> <input type="submit" value="search"> ...

Get Wicked Cool Shell Scripts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.