# http

### http.get

```lua
http.get(url): string
```

<table data-header-hidden><thead><tr><th width="271.3333333333333">Argument</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Argument</td><td>Type</td><td>Description</td></tr><tr><td>url</td><td>String</td><td>URL to request to</td></tr></tbody></table>

Returns the response of the website

### http.get\_async

```lua
http.get_async(url, method)
```

<table data-header-hidden><thead><tr><th width="265.7007853820236">Argument</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Argument</td><td>Type</td><td>Description</td></tr><tr><td>url</td><td>String</td><td>URL to request to</td></tr><tr><td>method</td><td>Table</td><td>Table containing the method that will be ran once the request is completed</td></tr></tbody></table>

This method wont hang the game while the request doesnt have a response

```lua
http.get_async("https://google.com", {
  run = function(text)
        client.print(text)
  end
})
```

### http.post

```lua
http.post(url): string
```

<table data-header-hidden><thead><tr><th width="271.3333333333333">Argument</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Argument</td><td>Type</td><td>Description</td></tr><tr><td>url</td><td>String</td><td>URL to request to, containing parameters</td></tr></tbody></table>

Returns the response of the website

### http.post\_async

```lua
http.post_async(url, method)
```

<table data-header-hidden><thead><tr><th width="265.7007853820236">Argument</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Argument</td><td>Type</td><td>Description</td></tr><tr><td>url</td><td>String</td><td>URL to request to, containing parameters </td></tr><tr><td>method</td><td>Table</td><td>Table containing the method that will be ran once the request is completed</td></tr></tbody></table>

This method wont hang the game while the request doesnt have a response

```lua
http.post_async("https://google.com", {
  run = function(text)
        client.print(text)
  end
})
```

### http.load

```lua
http.load(url): <?>
```

<table data-header-hidden><thead><tr><th width="265.7007853820236">Argument</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Argument</td><td>Type</td><td>Description</td></tr><tr><td>url</td><td>String</td><td>URL where the Lua code is</td></tr></tbody></table>

This method will load the code inside the specified URL into the script context

```lua
json = (http.load("http://regex.info/code/JSON.lua")())
```

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zarzel.gitbook.io/zarscript2/documentation/api-libs/http.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
