---
title: "HTTP"
description: "Static HTTP related functions."
canonical_url: "https://www.zeyos.com/zymba/ref/http"
markdown_url: "https://www.zeyos.com/ai/guide/zymba/ref/http.md"
section: "zymba-reference"
authority: "reference"
language: "en"
source_repository: "https://cloud.zeyos.com/__doc/zymbaref.json"
source_sha256: "05a361c6ddc32e74f4a6dc16fd06f218210ff1b7ce57f26ca1994bfffc407915"
---

# HTTP

## HTTP

```
object @HTTP() {
	canSendHeaders(): bool {}
	clearHeaders() {}
	countRequestHeaders(): int {}
	countResponseHeaders(): int {}
	getAuthenticationPassword(): string {}
	getAuthenticationUser(): string {}
	getDocumentRoot(): string {}
	getLocalAddress(): string {}
	getLocalHost(): string {}
	getLocalPort(): int {}
	getRemoteAddress(): string {}
	getRemoteHost(): string {}
	getRemotePort(): int {}
	getRequestBody(): string {}
	getRequestCookie(string $name): string {}
	getRequestFileUpload(string $name): object {}
	getRequestFormVariable(string $name): string {}
	getRequestHeader(string $name): string {}
	getRequestMethod(): string {}
	getRequestQuery(): string {}
	getRequestQueryVariable(string $name): string {}
	getRequestType(): string {}
	getRequestURL(): string {}
	getRequestVariable(string $name): string {}
	getResponseHeader(string $name): string {}
	getStatusCode(): int {}
	isConnectionAborted(): bool {}
	isConnectionSecure(): bool {}
	listRequestCookies(): object {}
	listRequestFileUploads(): object {}
	listRequestFormVariables(): object {}
	listRequestHeaderNames(): object {}
	listRequestHeaders(): object {}
	listRequestQueryVariables(): object {}
	listRequestVariables(): object {}
	listResponseHeaderNames(): object {}
	listResponseHeaders(): object {}
	removeHeader(string $name) {}
	removeHeaders(object $names) {}
	request(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): object {}
	requestBody(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): string {}
	setBasicAuthentication(string $realm) {}
	setCacheExpires(int $seconds) {}
	setCookie(string $name, string $value, int $expires, string $path, string $domain, bool $secure, bool $httponly) {}
	setHeader(string $name, string $value) {}
	setHeaders(object $headers, string $prefix) {}
	setStatusCode(int $code) {}
}
```

**Static HTTP related functions.**

## Functions


### `@HTTP.canSendHeaders()`


Determines whether HTTP response headers can be sent.

```code
@HTTP.canSendHeaders(): bool
```

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@HTTP.clearHeaders()`


Removes all previously set HTTP response headers.

```code
@HTTP.clearHeaders(): void
```




### `@HTTP.countRequestHeaders()`


Counts the total number of HTTP request headers.

```code
@HTTP.countRequestHeaders(): int
```

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@HTTP.countResponseHeaders()`


Counts the total number of HTTP response headers.

```code
@HTTP.countResponseHeaders(): int
```

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@HTTP.getAuthenticationPassword()`


```code
@HTTP.getAuthenticationPassword(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getAuthenticationUser()`


```code
@HTTP.getAuthenticationUser(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getDocumentRoot()`


Gets the path of the local server's document root directory.

```code
@HTTP.getDocumentRoot(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getLocalAddress()`


Gets the IP address of the local server.

```code
@HTTP.getLocalAddress(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getLocalHost()`


Gets the host name of the local server.

```code
@HTTP.getLocalHost(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getLocalPort()`


Gets the port number of the local server.

```code
@HTTP.getLocalPort(): int
```

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@HTTP.getRemoteAddress()`


Gets the IP address of the remote client.

```code
@HTTP.getRemoteAddress(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getRemoteHost()`


Gets the host name of the remote client.

```code
@HTTP.getRemoteHost(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getRemotePort()`


Gets the port number of the remote client.

```code
@HTTP.getRemotePort(): int
```

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@HTTP.getRequestBody()`


Gets the HTTP request body in raw format.

```code
@HTTP.getRequestBody(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getRequestCookie()`


Gets the value of a HTTP request cookie.

```code
@HTTP.getRequestCookie(string $name): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
| `null` |  |




### `@HTTP.getRequestFileUpload()`


Gets the details of a HTTP request file upload.

```code
@HTTP.getRequestFileUpload(string $name): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | ["name": ..., "type": ..., "tmp_name": ..., "error": ..., "size": ...] |
| `null` |  |




### `@HTTP.getRequestFormVariable()`


Gets the value of a HTTP request variable submitted via the POST method with content type "application/x-www-form-urlencoded" or "multipart/form-data" according to RFC 2388.

```code
@HTTP.getRequestFormVariable(string $name): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
| `null` |  |




### `@HTTP.getRequestHeader()`


Gets the value of a HTTP request header.

```code
@HTTP.getRequestHeader(string $name): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
| `null` |  |




### `@HTTP.getRequestMethod()`


Gets the HTTP request method.

```code
@HTTP.getRequestMethod(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getRequestQuery()`


Gets the query component of the HTTP request URL.

```code
@HTTP.getRequestQuery(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getRequestQueryVariable()`


Gets the value of a HTTP request variable submitted via the URL query component.

```code
@HTTP.getRequestQueryVariable(string $name): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
| `null` |  |




### `@HTTP.getRequestType()`


Gets the content type of the HTTP request.

```code
@HTTP.getRequestType(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getRequestURL()`


Gets the complete HTTP request URL.

```code
@HTTP.getRequestURL(): string
```

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.getRequestVariable()`


Gets the value of a HTTP request variable.

```code
@HTTP.getRequestVariable(string $name): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
| `null` |  |




### `@HTTP.getResponseHeader()`


Gets the value of a HTTP response header.

```code
@HTTP.getResponseHeader(string $name): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
| `null` |  |




### `@HTTP.getStatusCode()`


Gets the current HTTP response status code.

```code
@HTTP.getStatusCode(): int
```

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@HTTP.isConnectionAborted()`


Determines whether the current connection is aborted, meaning the client has disconnected.

```code
@HTTP.isConnectionAborted(): bool
```

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@HTTP.isConnectionSecure()`


Determines whether the current connection is secure, meaning over HTTPS.

```code
@HTTP.isConnectionSecure(): bool
```

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@HTTP.listRequestCookies()`


Lists all HTTP request cookies.

```code
@HTTP.listRequestCookies(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: value, ...] |




### `@HTTP.listRequestFileUploads()`


Lists the details of all HTTP request file uploads submitted via the POST method with content type "multipart/form-data" according to RFC 1867.

```code
@HTTP.listRequestFileUploads(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: ["name": ..., "type": ..., "tmp_name": ..., "error": ..., "size": ...], ...] |




### `@HTTP.listRequestFormVariables()`


Lists all HTTP request variables submitted via the POST method with content type "application/x-www-form-urlencoded" or "multipart/form-data" according to RFC 2388.

```code
@HTTP.listRequestFormVariables(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: value, ...] |




### `@HTTP.listRequestHeaderNames()`


Lists all HTTP request header names.

```code
@HTTP.listRequestHeaderNames(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name, ...] |




### `@HTTP.listRequestHeaders()`


Lists all HTTP request headers.

```code
@HTTP.listRequestHeaders(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: value, ...] |




### `@HTTP.listRequestQueryVariables()`


Lists all HTTP request variables submitted via the URL query component.

```code
@HTTP.listRequestQueryVariables(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: value, ...] |




### `@HTTP.listRequestVariables()`


Lists all HTTP request variables.

```code
@HTTP.listRequestVariables(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: value, ...] |




### `@HTTP.listResponseHeaderNames()`


Lists all HTTP response header names.

```code
@HTTP.listResponseHeaderNames(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name, ...] |




### `@HTTP.listResponseHeaders()`


Lists all HTTP response headers.

```code
@HTTP.listResponseHeaders(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: value, ...] |




### `@HTTP.removeHeader()`


Removes a HTTP response header.

```code
@HTTP.removeHeader(string $name): void
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |




### `@HTTP.removeHeaders()`


Removes multiple HTTP response headers.

```code
@HTTP.removeHeaders(object $names): void
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| names | `object`  | [name, ...] | [] |




### `@HTTP.request()`


```code
@HTTP.request(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| url | `string`  |  | "" |
| method | `string`  |  | "GET" |
| body | `string`  |  | "" |
| headers | `object`  | [name: value, ...] | [] |
| timeout | `int`  |  | 60 |
| validate | `bool`  |  | true |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | ["url": ..., "status": ..., "type": ..., "time": ..., "header": ..., "body": ...] |




### `@HTTP.requestBody()`


```code
@HTTP.requestBody(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| url | `string`  |  | "" |
| method | `string`  |  | "GET" |
| body | `string`  |  | "" |
| headers | `object`  | [name: value, ...] | [] |
| timeout | `int`  |  | 60 |
| validate | `bool`  |  | true |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@HTTP.setBasicAuthentication()`


```code
@HTTP.setBasicAuthentication(string $realm): void
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| realm | `string`  |  | "" |




### `@HTTP.setCacheExpires()`


```code
@HTTP.setCacheExpires(int $seconds): void
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| seconds | `int`  |  | 86400 |




### `@HTTP.setCookie()`


```code
@HTTP.setCookie(string $name, string $value, int $expires, string $path, string $domain, bool $secure, bool $httponly): void
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |
| value | `string`  |  | "" |
| expires | `int`  |  | 0 |
| path | `string`  |  | "" |
| domain | `string`  |  | "" |
| secure | `bool`  |  | false |
| httponly | `bool`  |  | false |




### `@HTTP.setHeader()`


Sets a HTTP response header.

```code
@HTTP.setHeader(string $name, string $value): void
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| name | `string`  |  | "" |
| value | `string`  |  | "" |




### `@HTTP.setHeaders()`


Sets multiple HTTP response headers by treating slot names as header names, expanded by a specific prefix, and slot values as non-referential header values.

```code
@HTTP.setHeaders(object $headers, string $prefix): void
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| headers | `object`  | [name: value, ...] | [] |
| prefix | `string`  |  | "" |




### `@HTTP.setStatusCode()`


Sets the HTTP response status code.

```code
@HTTP.setStatusCode(int $code): void
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| code | `int`  |  | 200 |
