Read Web Page

From Erlang Community

Revision as of 09:24, 12 January 2007 by Patricknharris (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)

[edit] Problem

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

[edit] Discussion

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

[edit] Solution

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