English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2003-11-11 (09:39)
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. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - 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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners