caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] access to the internet
@ 2003-11-10 17:56 Pierre LAFFITTE
  2003-11-11  9:21 ` Sven Luther
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre LAFFITTE @ 2003-11-10 17:56 UTC (permalink / raw)
  To: caml-list

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.

Thank you for your help.

Pierre

-------------------
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] access to the internet
  2003-11-10 17:56 [Caml-list] access to the internet Pierre LAFFITTE
@ 2003-11-11  9:21 ` Sven Luther
  2003-11-11  9:39   ` Richard Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Luther @ 2003-11-11  9:21 UTC (permalink / raw)
  To: Pierre LAFFITTE; +Cc: caml-list

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.

Friendly,

Sven Luther

-------------------
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] access to the internet
  2003-11-11  9:21 ` Sven Luther
@ 2003-11-11  9:39   ` Richard Jones
  2003-11-11 10:21     ` Artem Prisyznuk
  2003-11-11 14:20     ` Eric C. Cooper
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Jones @ 2003-11-11  9:39 UTC (permalink / raw)
  To: Sven Luther; +Cc: Pierre LAFFITTE, caml-list

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:

http://sourceforge.net/projects/ocurl/

which is an OCaml wrapper around the Curl library.

Or, you could use some Perl-fu with:

http://www.merjis.com/developers/perl4caml/

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).

Rich.

-- 
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:
http://www.annexia.org/freeware/monolith/

-------------------
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] access to the internet
  2003-11-11  9:39   ` Richard Jones
@ 2003-11-11 10:21     ` Artem Prisyznuk
  2003-11-11 17:54       ` Christophe TROESTLER
  2003-11-11 14:20     ` Eric C. Cooper
  1 sibling, 1 reply; 6+ messages in thread
From: Artem Prisyznuk @ 2003-11-11 10:21 UTC (permalink / raw)
  To: caml-list

On Tue, 11 Nov 2003 09:39:54 +0000, Richard Jones <rich@annexia.org> wrote:

  I'm preffer netclient library.

  http://www.ocaml-programming.de/programming/netclient.html

-- 
Artem Prysyznuk
tema@sit.kiev.ua

-------------------
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] access to the internet
  2003-11-11  9:39   ` Richard Jones
  2003-11-11 10:21     ` Artem Prisyznuk
@ 2003-11-11 14:20     ` Eric C. Cooper
  1 sibling, 0 replies; 6+ messages in thread
From: Eric C. Cooper @ 2003-11-11 14:20 UTC (permalink / raw)
  To: caml-list

On Tue, Nov 11, 2003 at 09:39:54AM +0000, Richard Jones wrote:
> On Tue, Nov 11, 2003 at 10:21:26AM +0100, Sven Luther wrote:
> > 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:
> 
> http://sourceforge.net/projects/ocurl/
> 
> which is an OCaml wrapper around the Curl library.
> 
> Or, you could use some Perl-fu with:
> 
> http://www.merjis.com/developers/perl4caml/

I use a very simple Curl wrapper.  Rather than exposing all the
knobs that libcurl has, it just exports simple get and post
functions:
    exception Error of string
    val get : string -> string
    val post : url:string -> data:string -> string
    val form : string -> (string * string) list -> string

Contact me if you want a copy.

-- 
Eric C. Cooper          e c c @ c m u . e d u

-------------------
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] access to the internet
  2003-11-11 10:21     ` Artem Prisyznuk
@ 2003-11-11 17:54       ` Christophe TROESTLER
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe TROESTLER @ 2003-11-11 17:54 UTC (permalink / raw)
  To: caml-list

On Tue, 11 Nov 2003, Artem Prisyznuk <tema@sit.kiev.ua> wrote:
> 
>   http://www.ocaml-programming.de/programming/netclient.html

open Http_client.Convenience

let body = http_get url

ChriS

-------------------
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-11-11 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-10 17:56 [Caml-list] access to the internet Pierre LAFFITTE
2003-11-11  9:21 ` Sven Luther
2003-11-11  9:39   ` Richard Jones
2003-11-11 10:21     ` Artem Prisyznuk
2003-11-11 17:54       ` Christophe TROESTLER
2003-11-11 14:20     ` Eric C. Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).