構文
HttpGet(context: DataModel, url: string, cache?: boolean | number): string引数
| 名前 | 型 | 説明 |
|---|---|---|
context | DataModel | Method-call self value. Use game:HttpGet(url, cache) or game:HttpGetAsync(url, cache). |
url | string | URL string to request. |
cache? | boolean | number | Optional cache control. true or numeric 1 enables the URL cache. |
戻り値
| 名前 | 型 | 説明 |
|---|---|---|
body | string | Downloaded 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)