caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Get a page from the Web
@ 2005-11-07 21:19 Martin Chabr
  2005-11-07 21:35 ` [Caml-list] " Karl Zilles
  2005-11-07 22:10 ` Florian Weimer
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Chabr @ 2005-11-07 21:19 UTC (permalink / raw)
  To: caml-list

Hello,

I have been looking for ways to get a page in HTML
from the Web, using an OCaml program, something like
the following Python snippet:

import urllib
URL = "http://www.ibm.com"
url = urllib.urlopen(URL)
html = url.read()

You supply the URL and receive the page in HTML. Is
there anything simple like that in OCaml?

Regards,

Martin



	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


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

* Re: [Caml-list] Get a page from the Web
  2005-11-07 21:19 Get a page from the Web Martin Chabr
@ 2005-11-07 21:35 ` Karl Zilles
  2005-11-07 22:10 ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Karl Zilles @ 2005-11-07 21:35 UTC (permalink / raw)
  To: Martin Chabr; +Cc: caml-list

Martin Chabr wrote:
> I have been looking for ways to get a page in HTML
> from the Web, using an OCaml program, something like
> the following Python snippet:
> 
> import urllib
> URL = "http://www.ibm.com"
> url = urllib.urlopen(URL)
> html = url.read()
> 
> You supply the URL and receive the page in HTML. Is
> there anything simple like that in OCaml?

I use the Ocaml binding to the curl library.  It has worked well for me 
and it can handle high level details like maintaining cookies across 
calls (for session continuity and logins):

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


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

* Re: [Caml-list] Get a page from the Web
  2005-11-07 21:19 Get a page from the Web Martin Chabr
  2005-11-07 21:35 ` [Caml-list] " Karl Zilles
@ 2005-11-07 22:10 ` Florian Weimer
  2005-11-08 10:40   ` Richard Jones
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2005-11-07 22:10 UTC (permalink / raw)
  To: Martin Chabr; +Cc: caml-list

* Martin Chabr:

> import urllib
> URL = "http://www.ibm.com"
> url = urllib.urlopen(URL)
> html = url.read()

You could use the Netclient library:

let s = Http_client.Convenience.http_get "http://www.ibm.com" in
  output_string stdout s

(Compile with: ocamlfind ocamlc -package netclient -linkpkg file.ml)


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

* Re: [Caml-list] Get a page from the Web
  2005-11-07 22:10 ` Florian Weimer
@ 2005-11-08 10:40   ` Richard Jones
  2005-11-09 18:13     ` Ant: " Martin Chabr
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Jones @ 2005-11-08 10:40 UTC (permalink / raw)
  To: caml-list

And yet another way is to use perl4caml[1] and WWW::Mechanize[2] which
is wrapped by perl4caml.  This allows you to fairly easily navigate
websites (click links, push buttons, fill in forms and so on).

Rich.

[1] http://merjis.com/developers/perl4caml/
[2] http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com


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

* Ant:  Re: [Caml-list] Get a page from the Web
  2005-11-08 10:40   ` Richard Jones
@ 2005-11-09 18:13     ` Martin Chabr
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Chabr @ 2005-11-09 18:13 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

Many thanks to all of you for the information!

Martin


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-07 21:19 Get a page from the Web Martin Chabr
2005-11-07 21:35 ` [Caml-list] " Karl Zilles
2005-11-07 22:10 ` Florian Weimer
2005-11-08 10:40   ` Richard Jones
2005-11-09 18:13     ` Ant: " Martin Chabr

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