Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] access to the internet
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] access to the internet
On Tue, Nov 11, 2003 at 10:21:26AM +0100, Sven Luther wrote:
> On Mon, Nov 10, 2003 at 06:56:25PM +0100, Pierre LAFFITTE wrote:
> > Is it possible from a caml program, to give an internet adress, to get the result in a file or in a set of character to analyse it.
> I have been searching for exactly that some time ago, but i think it is
> not possible. Your best guess currently is to call the external wget
> program, save it to a temporary file, and then read it in.
> I agree that a full url-reading module would be a good addition to the
> ocaml library though, java has it for example.

Actually there are two (at least) ways of doing this:

which is an OCaml wrapper around the Curl library.

Or, you could use some Perl-fu with:

which includes a wrapper around the Perl LWP and HTML::TreeBuilder
libraries, so you could not only download the page, but also parse it
into an HTML tree (the HTML::TreeBuilder parser is about the best
parser ever written for parsing fuzzy, incorrect HTML, and there's
really no way you would want reinvent this in OCaml).


Richard Jones.
Merjis Ltd. - improving website return on investment
MONOLITH is an advanced framework for writing web applications in C, easier
than using Perl & Java, much faster and smaller, reusable widget-based arch,
database-backed, discussion, chat, calendaring:

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: