CRequest::getServerVariable

The CRequest::getServerVariable function retrieves the value of a specified server environment variable.

chchar * getServerVariable(
chchar * variableName // containing the name of the specified server environment variable
);



Return Type

chchar *
Upon successful completion, a string which contains the value of a specified server environment variable. Otherwise, NULL is returned.


Parameters

variableName
A string which contains the name of a specified server environment variable.


Remarks

This function retrieves the value of the specified ServerVariable. The server environment variable can have one of the following names:

ALL_HTTP ALL_RAW APPL_MD_PATH APPL_PHYSICAL_PATH AUTH_PASSWORD AUTH_TYPE AUTH_USER CERT_COOKIE CERT_FLAGS CERT_ISSUER CERT_KEYSIZE CERT_SECRETKEYSIZE CERT_SERIALNUMBER CERT_SERVER_ISSUER CERT_SERVER_SUBJECT CERT_SUBJECT CONTENT_LENGTH CONTENT_TYPE GATEWAY_INTERFACE HTTP_<HeaderName> HTTP_ACCEPT HTTP_ACCEPT_LANGUAGE HTTP_USER_AGENT HTTP_COOKIE HTTP_REFERER HTTPS HTTPS_KEYSIZE HTTPS_SECRETKEYSIZE HTTPS_SERVER_ISSUER HTTPS_SERVER_SUBJECT INSTANCE_ID INSTANCE_META_PATH LOCAL_ADDR LOGON_USER PATH_INFO PATH_TRANSLATED QUERY_STRING REMOTE_ADDR REMOTE_HOST REMOTE_USER REQUEST_METHOD SCRIPT_NAME SERVER_NAME SERVER_PORT SERVER_PORT_SECURE SERVER_PROTOCOL SERVER_SOFTWARE URL

If a client sends a header other than those variables, the value of that header can be retrieved by prefixing the header name with HTTP_ in the call to this function. For example, if the client sent the header
 SomeNewHeader:SomeNewValue 
SomeNewValue can be retrieved by using the following syntax:
 headerValue = Request.getServerVariable("HTTP_SomeNewHeader"); 

See Also

CRequest

Example