Miscellaneous

HttpGet

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

Cú pháp

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

Đối số

TênKiểuMô tả
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.

Giá trị trả về

TênKiểuMô tả
bodystringDownloaded response body string, cached body string, or an empty string when the request cannot be opened.

Mô tả

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.

Goi voi 3 parameter: context, url, cache. Bang arguments giai thich gia tri nao bat buoc va gia tri nao chi tinh chinh hanh vi.

Tra ve body (string). Dung bang returns de tach gia tri thanh cong, ket qua nil va loi co the xu ly.

Ví dụ

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

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