Skip to main content

Zymba Documentation

HTTP

object @HTTP() {
canSendHeaders(): bool {}
clearHeaders() {}
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 {}
listRequestHeaders(): object {}
listRequestQueryVariables(): object {}
listRequestVariables(): object {}
listResponseHeaders(): object {}
removeHeader(string $name) {}
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
TypeValue
bool

Removes all previously set HTTP response headers.

@HTTP.clearHeaders(): void
@HTTP.getAuthenticationPassword(): string
Returns
TypeValue
string
@HTTP.getAuthenticationUser(): string
Returns
TypeValue
string

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

@HTTP.getDocumentRoot(): string
Returns
TypeValue
string

Gets the IP address of the local server.

@HTTP.getLocalAddress(): string
Returns
TypeValue
string

Gets the host name of the local server.

@HTTP.getLocalHost(): string
Returns
TypeValue
string

Gets the port number of the local server.

@HTTP.getLocalPort(): int
Returns
TypeValue
int

Gets the IP address of the remote client.

@HTTP.getRemoteAddress(): string
Returns
TypeValue
string

Gets the host name of the remote client.

@HTTP.getRemoteHost(): string
Returns
TypeValue
string

Gets the port number of the remote client.

@HTTP.getRemotePort(): int
Returns
TypeValue
int

Gets the HTTP request body in raw format.

@HTTP.getRequestBody(): string
Returns
TypeValue
string

Gets the value of a HTTP request cookie.

@HTTP.getRequestCookie(string $name): string
Parameters
NameTypeValueDefault
namestring""
Returns
TypeValue
string
null

Gets the details of a HTTP request file upload.

@HTTP.getRequestFileUpload(string $name): object
Parameters
NameTypeValueDefault
namestring""
Returns
TypeValue
object["name": ..., "type": ..., "tmp_name": ..., "error": ..., "size": ...]
null

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.

@HTTP.getRequestFormVariable(string $name): string
Parameters
NameTypeValueDefault
namestring""
Returns
TypeValue
string
null

Gets the value of a HTTP request header.

@HTTP.getRequestHeader(string $name): string
Parameters
NameTypeValueDefault
namestring""
Returns
TypeValue
string
null

Gets the HTTP request method.

@HTTP.getRequestMethod(): string
Returns
TypeValue
string

Gets the query component of the HTTP request URL.

@HTTP.getRequestQuery(): string
Returns
TypeValue
string

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

@HTTP.getRequestQueryVariable(string $name): string
Parameters
NameTypeValueDefault
namestring""
Returns
TypeValue
string
null

Gets the content type of the HTTP request.

@HTTP.getRequestType(): string
Returns
TypeValue
string

Gets the complete HTTP request URL.

@HTTP.getRequestURL(): string
Returns
TypeValue
string

Gets the value of a HTTP request variable.

@HTTP.getRequestVariable(string $name): string
Parameters
NameTypeValueDefault
namestring""
Returns
TypeValue
string
null

Gets the value of a HTTP response header.

@HTTP.getResponseHeader(string $name): string
Parameters
NameTypeValueDefault
namestring""
Returns
TypeValue
string
null

Gets the current HTTP response status code.

@HTTP.getStatusCode(): int
Returns
TypeValue
int

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

@HTTP.isConnectionAborted(): bool
Returns
TypeValue
bool

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

@HTTP.isConnectionSecure(): bool
Returns
TypeValue
bool

Lists all HTTP request cookies.

@HTTP.listRequestCookies(): object
Returns
TypeValue
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
TypeValue
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
TypeValue
object[name: value, ...]

Lists all HTTP request headers.

@HTTP.listRequestHeaders(): object
Returns
TypeValue
object[name: value, ...]

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

@HTTP.listRequestQueryVariables(): object
Returns
TypeValue
object[name: value, ...]

Lists all HTTP request variables.

@HTTP.listRequestVariables(): object
Returns
TypeValue
object[name: value, ...]

Lists all HTTP response headers.

@HTTP.listResponseHeaders(): object
Returns
TypeValue
object[name: value, ...]

Removes a HTTP response header.

@HTTP.removeHeader(string $name): void
Parameters
NameTypeValueDefault
namestring""
@HTTP.request(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): object
Parameters
NameTypeValueDefault
urlstring""
methodstring"GET"
bodystring""
headersobject[name: value, ...][]
timeoutint60
validatebooltrue
Returns
TypeValue
object["url": ..., "status": ..., "type": ..., "time": ..., "header": ..., "body": ...]
@HTTP.requestBody(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): string
Parameters
NameTypeValueDefault
urlstring""
methodstring"GET"
bodystring""
headersobject[name: value, ...][]
timeoutint60
validatebooltrue
Returns
TypeValue
string
@HTTP.setBasicAuthentication(string $realm): void
Parameters
NameTypeValueDefault
realmstring""
@HTTP.setCacheExpires(int $seconds): void
Parameters
NameTypeValueDefault
secondsint86400
@HTTP.setCookie(string $name, string $value, int $expires, string $path, string $domain, bool $secure, bool $httponly): void
Parameters
NameTypeValueDefault
namestring""
valuestring""
expiresint0
pathstring""
domainstring""
secureboolfalse
httponlyboolfalse

Sets a HTTP response header.

@HTTP.setHeader(string $name, string $value): void
Parameters
NameTypeValueDefault
namestring""
valuestring""

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
NameTypeValueDefault
headersobject[name: value, ...][]
prefixstring""

Sets the HTTP response status code.

@HTTP.setStatusCode(int $code): void
Parameters
NameTypeValueDefault
codeint200