Miscellaneous

HttpGet

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

構文

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

引数

名前説明
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.

戻り値

名前説明
bodystringDownloaded response body string, cached body string, or an empty string when the request cannot be opened.

説明

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.

3 個のパラメータで呼び出します: context, url, cache。引数表では必須値と動作を調整する値を確認できます。

body (string) を返します。戻り値表を使って成功値、nil 結果、回復可能なエラーを分けて扱ってください。

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

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