Advertisement
Ranger15

minecraft php to web

Jul 14th, 2019
599
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. local function sendOutput( text )
  2. local response = http.get(output .. "?output=" .. textutils.urlEncode(text))
  3. print("Connecting to http for output.")
  4. if response then
  5. -- if page is reseved
  6. if response then
  7. print("Sending output.")
  8. local sResponse = response.readAll()
  9. response.close()
  10. end
  11. end
  12. end
  13.  
  14. dir = "http:///mc/"
  15. input = dir .. "input.txt"
  16. output = dir .. "getOutput.php"
  17. while true do
  18. print("Connecting to http")
  19.         local response = http.get(input)
  20.          if response then
  21.          print("Page found attepting to download.")
  22. -- if page is reseved
  23. while response do
  24. local sResponse = response.readAll()
  25.                 response.close()
  26.                 cache = shell.resolve( "temp" )
  27.                 local file = fs.open( cache, "w" )
  28.                 file.write( sResponse )
  29.                 file.close()
  30.                 response = nil
  31.                 print("Running input from http.")
  32.                 shell.run( "temp" )
  33. end
  34.    text = "Finished Running Code."
  35.    sendOutput("Finished Running Code.")
  36. else
  37.    print("Page not found.")
  38. end
  39. print("Yileding befor loop.")
  40. os.sleep( 5 )
  41. shell.run( "clear" )
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement