Adilol

[LUA]Downloading a file

Aug 3rd, 2011
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. --[[
  2. Simple LUA socket connection
  3. Checks a webserver (host) for a file
  4. Then prompts port 80 with a request for the file
  5. File downloads
  6. ]]
  7. require "luasocket" --Much like the #include in C
  8. host = "www.caustik.heliohost.org" --Specifiying the host
  9. file = "/filepack/ElephantArchive.zip"--Choosing the file
  10.  c = assert(socket.connect(host, 80))--Connecting to the apache port
  11.  c:send("GET " .. file .. " HTTP/1.0\r\n\r\n")--Requesting the file
  12. c:close()--Closing the connection
Add Comment
Please, Sign In to add comment