W3C libwww FAQ

How can I download a Document?

Q

I would like to have a small programme which use your library just to get a document from a WWW server (the most simple possible).

A

You can use the Line Mode Browser (LMB) as a stating point for doing this. You can download a document in many ways depending on what you give as parameters to the Line Mode Browser. Some examples are:
	www -source http://foo.bar.com/fred.html
which gives you the source code on the screen, or
	www http://foo.bar.com/fred.html -o local.html
which downloads it, formats it for the screen and and puts it in a file, or
	www -to text/latex http://foo.bar.com/fred.html
which converts it into latex (sort of). There are a lot more combinations, but maybe whatever you want, you can look at the Line Mode Browser and take out the source code used for support of the command line parameters.

NOTEDon't be confused about the mention about threaded execution in LMB. In the case where you are only downloading one document (for example in non-interactive mode which can be forced using the argument '-n'), LMB uses normal, blocking I/O. Likewise if you disable the multithraeded functionality using the flag '-single'.

You can find information on the architecture of the Library in the Internals and Programmer's Guide


Henrik Frystyk, libwww@w3.org, April 1995