Lua-cURLv3/examples/cURLv2/file.lua

16 lines
296 B
Lua

local cURL = require("cURL")
-- open output file
f = io.open("example_homepage", "w")
c = cURL.easy_init()
-- setup url
c:setopt_url("http://www.example.com/")
-- perform, invokes callbacks
c:perform{writefunction = function(str)
f:write(str)
end}
-- close output file
f:close()
print("Done")