BillBodkin

Untitled

Sep 17th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1.  
  2.  
  3. local attachedMonitor = peripheral.wrap("top")
  4.  
  5. while true do
  6.     http.request("https://pastebin.com/raw/VPS8zR5n")
  7.     local requesting = true
  8.  
  9.     while requesting do
  10.       local event, url, sourceText = os.pullEvent()
  11.      
  12.       if event == "http_success" then
  13.         local respondedText = sourceText.readAll()
  14.        
  15.         sourceText.close()
  16.         print(respondedText)
  17.         attachedMonitor.clear()
  18.         attachedMonitor.setCursorPos(1,1)
  19.         attachedMonitor.write(respondedText)
  20.        
  21.         requesting = false
  22.       elseif event == "http_failure" then
  23.         print("Server didn't respond.")
  24.        
  25.         requesting = false
  26.       end
  27.     end
  28.     sleep(60)
  29. end
Add Comment
Please, Sign In to add comment