Erlang Central

Read Web Page

Revision as of 09:24, 12 January 2007 by GeScript (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Problem

You want to get the contents of a web page. Output are the list of lines from the web page.

Discussion

The ibrowse package is not an intrinsic erlang library; it can be obtained from the erlang user contribs section.

Solution

ibrowse:start().
 {ok, _StatusCode, _Headers, WebPageText} = ibrowse:send_req("http://www.google.com", [], get),
     Lines = string:tokens(WebPageText, "\n").