Advertisement
sanovskiy

test cc dl

Jan 26th, 2022
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. function dl(sUrl)
  2. -- Check if the URL is valid
  3. local ok, err = http.checkURL(sUrl)
  4. -- print("Downloading "..sUrl.." into "..file)
  5. if not ok then
  6. printError(err or "Invalid URL.")
  7. return false
  8. end
  9.  
  10. local response = http.get(sUrl , { ["Cache-Control"] = "no-cache" } , true)
  11. if not response then
  12. printError("Download failed.")
  13. return false
  14. end
  15.  
  16. local sResponse = response.readAll()
  17. response.close()
  18. return sResponse
  19. end
  20.  
  21. print dl('https://www.random.org/integers/?num=1&min=1000000&max=9999999&col=1&base=10&format=plain&rnd=new')
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement