angles-righthttp

Functions for making HTTP requests, allowing you to retrieve website content and send POST requests with payloads.

http get(website, function: body, statuscode) -> void

Retrieves websites body.

Name
Type
Description

website

string

Website address.

function

function

Callback function.

body

string

Data returned by the website.

statuscode

number

Status code returned by the website.

http post(website, payload, function: body, statuscode) -> void

Sends a post to the website.

Name
Type
Description

website

string

Website address.

payload

string

Data to post.

body

string

Data returned by the website.

statuscode

number

Status code returned by the website.

Example

http.get("https://cataas.com/cat", function(body, stats)
    if stats == 200 then -- 200 = success, 500 = error
        local filename = "random_cat.jfif"
        file.write(filename, body, "binary")
    end
end)

Last updated