· 2 years ago · Dec 13, 2022, 01:00 AM
1local http = require("socket.http")
2
3-- Set the API endpoint URL and your API key
4local api_url = "https://pastebin.com/api/api_post.php"
5local api_key = "X8AI94uRWWUPaW_LxYjWcxoTN2bu4hVO"
6
7-- Set the parameters for the API request
8local params = {
9 api_dev_key = api_key,
10 api_option = "paste",
11 api_paste_code = "This is a test. Did this work?"
12}
13
14-- Build the query string from the parameters
15local query_string = ""
16for key, value in pairs(params) do
17 query_string = query_string .. key .. "=" .. value .. "&"
18end
19
20-- Make the HTTP request to the API endpoint
21local response = http.request(api_url .. "?" .. query_string)
22
23-- Print the response from the API
24print(response)
25