Overview

A web client is just a machine connected to the Internet, running a computer program that sends requests for content to web servers, and processes what comes back, typically HTML files. Although browsers are far and way the most common web client, any program with the appropriate network code can talk to a web server.

There are two packages of code available for Franz's Allegro Lisp that make it easy to write simple web clients:

do-http-request

do-http-request is very easy to use. Here's a simple example:

(net.aserve.client:do-http-request "http://www.cs.northwestern.edu/")

This will return a string with the entire HTML for the page at http://www.cs.northwestern.edu/. Try it and see.

Documentation on do-http-request is part of the AllegroServe documentation.

parse-html

parse-html is also very easy to use. Here's a simple example:

(net.html.parser:parse-html "<html><body>Hello</body></html>")

This will return the list:

(:html (:body "Hello"))

This is the list format that the HTML generator macro, html, uses to generate HTML text. This list format makes it very simple to write Lisp code to extract material stored in tags in an HTML file.

The xmlutils package also includes parse-xml which is for parsing XML files.

Documentation on parse-html comes with the xmlutils library.

Caution: Be sure to compile phtml.cl and load phtml.fasl version.

Faculty: Chris Riesbeck
Time: Monday, Wednesday, Friday: 1pm - 2pm
Location:Annenberg G15

Contents

Important Links