Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get(code)
- local val= {}
- local httphandle = http.get("https://pastebin.com/raw/"..code)
- if not httphandle then
- val.status = "failure"
- val.content = "The PastebinApi failed to download the file. If you see this, that means something is terribly wrong with the program utilising my API."
- else
- val.status = "fetched"
- val.content = httphandle.readAll()
- end
- return val
- end
- function login(username,password)
- local val = {}
- local devkey = "b25628a557387174679205df2dea582c"
- local statement = "api_dev_key="..devkey.."&api_user_name="..username.."&api_user_password="..password
- local response = http.post("https://pastebin.com/api/api_login.php",statement).readAll()
- if response == "Bad API request, invalid login" then
- val.status = "BadLogin"
- elseif response == "Bad API request, account not active" then
- val.status = "AccInactive"
- else
- val.status = "Fine"
- val.key = response
- end
- return val
- end
- function putAsGuest(content,title)
- local val = {}
- local devkey = "b25628a557387174679205df2dea582c"
- local statement = "api_dev_key="..devkey.."&api_option=paste&api_paste_code="..content.."&api_paste_format=lua&api_paste_expire_date=N&api_paste_name="..title
- response = http.post("http://pastebin.com/api/api_post.php",statement).readAll()
- print(response)
- end
- function putAsUser(content,title,userkey)
- local val = {}
- local devkey = "b25628a557387174679205df2dea582c"
- local statement = "api_dev_key="..devkey.."&api_option=paste&api_paste_code="..content.."&api_paste_format=lua&api_paste_expire_date=N&api_paste_name="..title.."&api_user_key="..userkey
- response = http.post("http://pastebin.com/api/api_post.php",statement).readAll()
- print(response)
- end
Add Comment
Please, Sign In to add comment