> For the complete documentation index, see [llms.txt](https://zarzel.gitbook.io/zarscript2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zarzel.gitbook.io/zarscript2/documentation/api-libs/http.md).

# http

Request functions, this functions will only work when the unsafe script functionality is turned on

### 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")())
```

###
