Introduction
The ResponseObject is used in web-enabled ZPE environments to configure HTTP response headers and status codes.
Internally, it stores response metadata in a global map named
$_RESPONSE_HEADERS, which is later processed by the runtime
to construct the outgoing HTTP response.
This object is primarily intended for server-side scripting scenarios such as APIs, dynamic web pages, or REST-style endpoints.
All functions exposed by this object require a permission level of 0.
Response object functions
The following is a list of internal functions the ResponseObject exposes. All functions are ZPEObjectNativeFunctions therefore run in native code.
-
set_header(string header, string value) ⇒ boolean -
Sets an HTTP response header.
The header name and value are stored in the global
$_RESPONSE_HEADERSmap. Returns true. -
set_http_response(string status) ⇒ boolean -
Sets the HTTP status code for the response.
The status is stored internally under the key
http_statuswithin the$_RESPONSE_HEADERSmap. Returns true.
Examples
Setting a simple content type header:
$response = new ResponseObject() $response->set_header("Content-Type", "application/json")
Setting a custom header:
$response->set_header("X-Powered-By", "ZPE")
Setting the HTTP response status:
$response->set_http_response("404")
Notes:
-
Global storage: Headers are stored in the global
$_RESPONSE_HEADERSmap. -
Status code: The HTTP status is stored under the key
http_status. - Server context: This object is meaningful only in web/server execution environments.

There are no comments on this page.
Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days. Your email address is stored so that replies can be sent to your email address.
Comments powered by BalfComment