In "Programming with the HTTP Protocol", Web Techniques, July 1996, I described how the HTTP GET request method can be used to retrieve Web pages and to query search engines and databases. However, this approach is somewhat limiting since the query included with a GET message can usually be no longer than 1024 characters. An alternative approach is to utilise the HTTP POST method, which places no limits on the query's size.
This article begins by showing how the output from a form can be displayed without using a browser (see listen.c). The example is db-form.html, an interface to a Web-based membership database. This allows us to develop replacements for the form and browser which output similar requests. The first 'replacement' uses telnet to send POST messages to the server. Next, a C program is developed which uses sockets to post queries to the membership database (see qdir_post.c). We finish with a general-purpose (but more complex) program that can send POST requests to any Web address (see sock_post.c).