--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
(ns google-search(def user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172")(defn open-connection [url](doto (.openConnection url)(.setRequestProperty "User-Agent" user-agent)))(defn get-response [url](let [conn (open-connection url)in (.getInputStream conn)sb (StringBuilder.)](loop [c (.read in)](if (neg? c)(str sb)(do(.append sb (char c))(recur (.read in)))))))(defn search [query](let [url (URL. (str google-search-url (URLEncoder/encode query)))](get-response url)))(spit "response.html" (search "URLEncoder java 7"))HIH,
(do(.append sb (char c))
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/QwKmsLwLhjE/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
(ns google-search(def user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172")(defn open-connection [url](doto (.openConnection url)(.setRequestProperty "User-Agent" user-agent)))(defn get-response [url](let [conn (open-connection url)
Jsb (StringBuilder.)](slurp (.getInputStream conn))))(defn search [query](let [url (java.net.URL. (str google-search-url (URLEncoder/encode query)))](get-response url)))(spit "response.html" (search "clojure google"))