Zymba Documentation
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
Determines whether HTTP response headers can be sent.
@HTTP.canSendHeaders(): bool
Returns
| Type | Value |
|---|---|
bool |
Removes all previously set HTTP response headers.
@HTTP.clearHeaders(): void
Counts the total number of HTTP request headers.
@HTTP.countRequestHeaders(): int
Returns
| Type | Value |
|---|---|
int |
Counts the total number of HTTP response headers.
@HTTP.countResponseHeaders(): int
Returns
| Type | Value |
|---|---|
int |
Gets the path of the local server's document root directory.
@HTTP.getDocumentRoot(): string
Returns
| Type | Value |
|---|---|
string |
Gets the IP address of the remote client.
@HTTP.getRemoteAddress(): string
Returns
| Type | Value |
|---|---|
string |
Gets the query component of the HTTP request URL.
@HTTP.getRequestQuery(): string
Returns
| Type | Value |
|---|---|
string |
Determines whether the current connection is aborted, meaning the client has disconnected.
@HTTP.isConnectionAborted(): bool
Returns
| Type | Value |
|---|---|
bool |
Determines whether the current connection is secure, meaning over HTTPS.
@HTTP.isConnectionSecure(): bool
Returns
| Type | Value |
|---|---|
bool |
Lists all HTTP request cookies.
@HTTP.listRequestCookies(): object
Returns
| Type | Value |
|---|---|
object | [name: value, ...] |
Lists the details of all HTTP request file uploads submitted via the POST method with content type "multipart/form-data" according to RFC 1867.
@HTTP.listRequestFileUploads(): object
Returns
| Type | Value |
|---|---|
object | [name: ["name": ..., "type": ..., "tmp_name": ..., "error": ..., "size": ...], ...] |
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.
@HTTP.listRequestFormVariables(): object
Returns
| Type | Value |
|---|---|
object | [name: value, ...] |
Lists all HTTP request header names.
@HTTP.listRequestHeaderNames(): object
Returns
| Type | Value |
|---|---|
object | [name, ...] |
Lists all HTTP request headers.
@HTTP.listRequestHeaders(): object
Returns
| Type | Value |
|---|---|
object | [name: value, ...] |
Lists all HTTP request variables submitted via the URL query component.
@HTTP.listRequestQueryVariables(): object
Returns
| Type | Value |
|---|---|
object | [name: value, ...] |
Lists all HTTP request variables.
@HTTP.listRequestVariables(): object
Returns
| Type | Value |
|---|---|
object | [name: value, ...] |
Lists all HTTP response header names.
@HTTP.listResponseHeaderNames(): object
Returns
| Type | Value |
|---|---|
object | [name, ...] |
Lists all HTTP response headers.
@HTTP.listResponseHeaders(): object
Returns
| Type | Value |
|---|---|
object | [name: value, ...] |
Removes a HTTP response header.
@HTTP.removeHeader(string $name): void
Parameters
| Name | Type | Value | Default |
|---|---|---|---|
| name | string | "" |
Removes multiple HTTP response headers.
@HTTP.removeHeaders(object $names): void
Parameters
| Name | Type | Value | Default |
|---|---|---|---|
| names | object | [name, ...] | [] |
@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.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 |
Sets a HTTP response header.
@HTTP.setHeader(string $name, string $value): void
Parameters
| Name | Type | Value | Default |
|---|---|---|---|
| name | string | "" | |
| value | string | "" |
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.
@HTTP.setHeaders(object $headers, string $prefix): void
Parameters
| Name | Type | Value | Default |
|---|---|---|---|
| headers | object | [name: value, ...] | [] |
| prefix | string | "" |
Sets the HTTP response status code.
@HTTP.setStatusCode(int $code): void
Parameters
| Name | Type | Value | Default |
|---|---|---|---|
| code | int | 200 |