Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- host = "http://86.11.11.101/"
- local function printUsage()
- print( "Usages:" )
- print( "rget <code> [filename]" )
- end
- local tArgs = { ... }
- if #tArgs < 1 then
- printUsage()
- return
- end
- local sCode = tArgs[1]
- local sPath = tArgs[2] or sCode
- write("Connecting to server...")
- local response = http.get(host .. textutils.urlEncode(sCode))
- if response then
- print( "Success." )
- local sResponse = response.readAll()
- response.close()
- local file = fs.open( sPath, "w" )
- file.write( sResponse )
- file.close()
- print( "Downloaded as ".. sPath )
- else
- print("Failed to download.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement