cduce_curl.ml 324 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
let load_url s =
  let buff = Buffer.create 4096 in 
  let conn = Curl.init () in
  Curl.set_url conn s;
  Curl.set_writefunction conn (Buffer.add_string buff);
  Curl.perform conn;
  Buffer.contents buff


let () = 
11 12 13 14
  Config.register 
    "curl" 
    "Load external URLs with curl"
    (fun () -> Url.load_url := load_url)