Advertisement
Pirnogion

testpstbn

Mar 27th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1, 1)
  3.  
  4. --Variables
  5. local username = nil
  6. local password = nil
  7.  
  8. local userkey = nil
  9. local key = "e98db6da803203282d172156bc46137c"
  10. local pastebin_url = nil
  11.  
  12. print("Pastebin. Login.")
  13. write("Write your login: ")
  14. local username = read()
  15.  
  16. write("Write your password: ")
  17. local password = read("*")
  18.  
  19. print("Please wait...")
  20.  
  21. local login = http.post(
  22.     "http://pastebin.com/api/api_login.php",
  23.     "api_dev_key="..key..
  24.     "&api_user_name="..username..
  25.     "&api_user_password="..password
  26. )
  27.  
  28. if login then
  29.     userkey = login.readAll()
  30.     write("Success. Your userkey: " .. userkey)
  31.     print("")
  32.     print("")
  33. else
  34.     login.close()
  35.     error("Login failed.")
  36. end
  37. login.close()
  38.  
  39. local sName = "SUPERTESTIDINAXUI"
  40. local sText = "This is code!"
  41.  
  42. local response = http.post(
  43.     "http://pastebin.com/api/api_post.php",
  44.     "api_option=paste&"..
  45.     "api_dev_key="..key.."&"..
  46.     "api_user_key="..userkey.."&"..
  47.     "api_paste_private=0&"..
  48.     "api_paste_format=lua&"..
  49.     "api_paste_name="..textutils.urlEncode(sName).."&"..
  50.     "api_paste_code="..textutils.urlEncode(sText)
  51. )
  52.  
  53. if response then
  54.     pastebin_url = response.readAll()
  55.     write("Success. Your pastebin: " .. pastebin_url)
  56. else
  57.     print("Download failed.")
  58. end
  59. response.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement