Skip to main content

Global Variables

The Global variables loaded by this interface are listed below.

Global Variable

Description

Apache Environment Value

%args$ [ ]

This string array will contain all the arguments passed to the program from the original URL/Query request. This array is one based.

%args

This numeric variable contains the number of arguments within the array %args$.

%body_content$

This variable will contain the complete contents of the body of the request as received from the workstation.

<raw input>

%cache_control$

Value returned in the Cache-Control response header. If left blank, no Cache-Control header is sent.

%content_filename$

If set to a file name (no path), a Content-Disposition: attachment header is returned, prompting the browser to download ("Save As") the response using this file name.

%content_length

This variable contains the length of %body_content$ (length of body text as received from the browser workstation).

CONTENT_LENGTH

%content_type$

This variable will contain the type of contents received from the browser.

CONTENT_TYPE

%cookie.rcv

Number of cookies that were received from the workstation with the request.

%cookie.snd

This variable is set initially to zero and will be incremented by the *web/cookie to track the number of cookies that will be downloaded to the workstation.

%document_root$

This will have the root directory as provided by the 'DocumentRoot' directive in the Apache configuration. Generally, this will be where the server files reside.

Example:

%DOCUMENT_ROOT$="/var/www/myweb/html"

DOCUMENT_ROOT

%document_url$

Actual URL being processed.

REDIRECT_URL

%exit_code

HTTP status code returned to the browser for this request. Typically 200 ("OK").

Assign a value to force a specific code. A value of 300 or greater triggers redirect or error handling. Valid codes include:

   200 - OK
   201 - Created
   202 - Accepted
   204 - No Content
   300 - Multiple Choices
   301 - Moved Permanently
   302 - Moved Temporarily
   304 - Not Modified
   307 - Temporary Redirect
   400 - Bad Request
   401 - Unauthorized
   403 - Forbidden
   404 - Not Found
   500 - Internal Server Error
   501 - Not Implemented
   502 - Bad Gateway
   503 - Service Unavailable

%exit_include_html

When set together with an %exit_code of 300 or greater, the output sent to %print_fn is returned to the browser instead of the generic error message page.

Often used to return additional error information or JSON detailing the problem.

(The %exit_include_html variable was added in PxPlus 2021.)

%exit_text$

Status reason text returned with %exit_code. If left blank, it is filled automatically from the standard text for that status code.

%expires$

Value returned in the Expires response header. If left blank, a default (past) expiry date is sent; otherwise, the supplied value is used.

%ezweb_log$

(EZWeb Server Only)

Path of the EZWeb access log. Not set under the Apache interface.

%http_accept$

This field will contain the MIME types that the requesting browser will accept according to the HTTP header.

HTTP_ACCEPT

%http_accept_encoding$

This contains the types of MIME encoding that the requesting browser will accept according to the HTTP header.

HTTP_ACCEPT_ENCODING

%http_accept_language$

This field will have the LANGUAGE types browser is requesting the server to supply.

Example:

%HTTP_ACCEPT_LANGUAGE$="en-us"

HTTP_ACCEPT_LANGUAGE

%http_cookie$

This variable will contain the string defining the cookies received from the workstation. Each cookie will be semi-colon separated.

HTTP_COOKIE

%http_extraheaders$

This variable can be loaded by the application with additional HTTP headers to be returned with the Web page. Each header should be separated by $0A$ or the SEP character.

(The %http_extraheaders$ variable was added in PxPlus v11.00.)

%http_host$

The Host header supplied by the browser for this request (distinct from %server_name$).

HTTP_HOST

%http_user_agent$

This field contains the type of browser or requesting program.

HTTP_USER_AGENT

%lang$

Language code to use for application (this is hard-coded to ".en").

%new_location$

Redirect target URL.

To force the browser to request another URL, set %new_location$ to that URL and set %exit_code to 301 (or 302/303/307). Both must be set.

Returned as the Location header.

%path_translated$

Pathname to the target file that the request was looking for.

PATH_TRANSLATED

%path_info$

This field contains the relative pathname.

PATH_INFO

%print_fn

Logical file number to which your application should print (send) the HTML response.

When not running in Debug mode and cookies disabled, this will be 0 (zero); otherwise, it will point to a memory file that holds the output pending transmission to the workstation.

%query_string$

Parameters following the "?" in the URL for this request.

QUERY_STRING

%raw_text

   0 = Output sent to the browser as is.
   1 = Wrap an HTML header/body around the output from the PxPlus application.

%remote_ip$

Remote workstation/browser IP address.

REMOTE_ADDR

%request_method$

Type of HTTP request being processed; i.e. "POST", "GET" or "HEAD".

REQUEST_METHOD

%script_name$

This field will contain the file name of the CGI Script relative to DOCUMENT_ROOT directory.

SCRIPT_NAME

%server_address$

Server IP address plus port number.

SERVER_ADDR"+":"+"SERVER_PORT"

%server_admin$

Email address for the system administrator as defined in the Apache configuration file.

SERVER_ADMIN

%server_ip$

Server IP address.

SERVER_ADDR

%server_name$

Server name as extracted from the HTTP request.

SERVER_NAME

%server_port$

Server port number as a string. %server_port is the same value as a number.

SERVER_PORT

%server_protocol$

Type and version of protocol being used for the request (HTTP/1.1, etc...).

SERVER_PROTOCOL

%server_rootdir$

Document root directory.

%server_secure

Set to 1 when the request was received over HTTPS; otherwise, 0.

HTTPS

%server_software$

Name of the server and associate software as reported to the browser.

SERVER_SOFTWARE

%text_title$

Title used for the generated HTML page when %raw_text=1.