cduce_curl.ml 326 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
  Config.register 
    "curl" 
    "Load external URLs with curl"
14
    (fun () -> Url.url_loader := load_url)