将网页读入字符串

Read webpage into string

这应该很容易做到,但我的 Google 技能让我失望了。我想将网页读入字符串或字符串列表,类似于 Core 中的 "In_channel.read_lines file"。

OCaml 中有几个库可以为您处理 http,我想到了三个:ocaml curl、ocamlnet 和 ocaml-http。我只使用了后者,但似乎ocamlnet提供了一个非常方便的功能:http_get : string -> string, that do exactly what you want. What concerning ocaml-http it also provides nice interface, but it uses monads. For example, this interface provides IO functions lifted into LWT monad. And here是提升到async monad的接口。