http

loadstring

load - "URL"

Loads and compiles code from an external website. Must be outside of a function in this format.

request

Request request = new Request(String method, String URL);

Creates a new request to a specified URL. Supported methods: "GET", "POST".

addHeader

request.addHeader(String header, String value);

Adds a header to the request.

setUserAgent

request.setUserAgent(String userAgent);

Sets the User-Agent header for the request.

setConnectionTimeout

request.setConnectTimeout(int timeout);

Sets the connection timeout for the request.

setReadTimeout

request.setReadTimeout(int timeout);

Sets the read timeout for the request.

setContent

request.setContent(String content);

Sets the content to be sent with a POST request.

fetch

Response response = request.fetch();

Executes the request.

code

int code = response.code();

Returns the response code for a request.

string

String string = response.string();

Returns the data from a request as a string.

json

Json json = response.json();

Returns the data from a request as json.

Last updated