HTTP
Print a URL's content.
HTTP
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
Erlang
-module(main). -export([main/1]). main([Url|[]]) -> inets:start(), case http:request(Url) of {ok, {_V, _H, Body}} -> io:fwrite("~p~n",[Body]); {error, Res} -> io:fwrite("~p~n", Res) end.
Using it
|escript ./req.erl http://www.rosettacode.org
Perl
<perl>using LWP::Simple; print get("http://www.rosettacode.org");</perl>
PHP
<php>print(file_get_contents("http://www.rosettacode.org"));</php>
Python
<python>import urllib print urllib.urlopen("http://www.rosettacode.org").read()</python>