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)