httpget
GET a URL and return the response body as a string.
Syntax
httpget(url: string, headers?: table) -> string
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | The target URL. |
headers? | table | A table of request headers. |
Returns
| Type | Description |
|---|---|
string | Body |
Description
httpget is part of the HTTP library. HTTP functions use the external WinHTTP client and return the raw response body or response table.
The operation is performed immediately using the arguments supplied at the call site.
The aliases HttpGet(url, headers?) resolve to the same implementation.
Example
local body = httpget("https://httpbin.org/get")
print(body)
Notes
- Aliases:
HttpGet(url, headers?). - HTTP requests are made through the external WinHTTP client.