P
P
prog3232014-04-23 23:36:30
Erlang
prog323, 2014-04-23 23:36:30

How to get a website page in erlang and write it to an html file?

There is a site.ru page address
1. you need to get the html page and write it to the html file
2. get the page load time
3. get the page size
how to make 1,2,3 ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-04-24
@prog323

1. www.erlang.org/doc/man/httpc.html , www.erlang.org/doc/man/file.html#write_file-2
2. timer:tc ( www.erlang.org/doc/man/timer .html#tc-1 ) specifically in your case:
timer:tc(httpc, request, [ argument list ] )
3. httpc:request returns data in the following format:
{status_line(), headers(), Body} - respectively, you must match:
{Status, Header, Body} = httpc:request(....),
Body size:
size(Body) - if you are working with binary(),
length(Body) - if you are working with a list
PS Also note item 2.
Learn the language, read manuals. No one will write the working code for you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question