2014-09-11 00:50:48 -07:00
|
|
|
local cURL = require("cURL")
|
|
|
|
|
|
|
|
-- setup easy and url
|
|
|
|
c1 = cURL.easy{url = "http://www.lua.org/"}
|
|
|
|
c2 = cURL.easy{url = "http://luajit.org/"}
|
|
|
|
|
|
|
|
m = cURL.multi()
|
|
|
|
:add_handle(c1)
|
|
|
|
:add_handle(c2)
|
|
|
|
|
|
|
|
local f1 = io.open("lua.html", "w+b")
|
|
|
|
local f2 = io.open("luajit.html", "w+b")
|
|
|
|
|
|
|
|
for data, type, easy in m:iperform() do
|
2014-09-15 01:20:08 -07:00
|
|
|
if type == "data" and c1 == easy then f1:write(data) end
|
|
|
|
if type == "data" and c2 == easy then f2:write(data) end
|
2014-09-11 00:50:48 -07:00
|
|
|
end
|