Miscellaneous

HttpGet

Performs a GET request for game:HttpGet(url, cache) or game:HttpGetAsync(url, cache) and returns the response body string.

Syntaxe

HttpGet(context: DataModel, url: string, cache?: boolean | number): string

Arguments

NomTypeDescription
contextDataModelMethod-call self value. Use game:HttpGet(url, cache) or game:HttpGetAsync(url, cache).
urlstringURL string to request.
cache?boolean | numberOptional cache control. true or numeric 1 enables the URL cache.

Retours

NomTypeDescription
bodystringDownloaded response body string, cached body string, or an empty string when the request cannot be opened.

Description

Performs a GET request for game:HttpGet(url, cache) or game:HttpGetAsync(url, cache) and returns the response body string. The URL must pass Real's URL restrictions.

Appelle le avec 3 parametre(s): context, url, cache. La table des arguments indique les valeurs requises et celles qui affinent le comportement.

Il renvoie body (string). Utilise la table des retours pour separer les valeurs reussies, les resultats nil et les erreurs recuperables.

Exemple

Run a DataModel-style GET request and return the response body string.

local body = game:HttpGet("https://example.com", true)
print(body)