Skip to content

Instantly share code, notes, and snippets.

@yang-wei
Created April 11, 2016 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yang-wei/f4b38bff97f9fcad659c3fa7491ad73f to your computer and use it in GitHub Desktop.
Save yang-wei/f4b38bff97f9fcad659c3fa7491ad73f to your computer and use it in GitHub Desktop.
Clojure fetch url
(defn fetch-url[address]
(with-open [stream (.openStream (java.net.URL. address))]
(let [buf (java.io.BufferedReader.
(java.io.InputStreamReader. stream))]
(apply str (line-seq buf)))))
(fetch-url "http://google.com")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment