$Web_Hdr_Parm
Jump to navigation
Jump to search
Value of request header field
$Web_Hdr_Parm retrieves the value of a request header field.
Syntax
%string = $Web_Hdr_Parm( fieldname, occurrence, [start], [length] )
Syntax terms
%string | A string variable to contain the returned field value, or to contain a null for any error condition. |
---|---|
fieldname | The name of the header field, returned by $Web_Hdr_Name. Required argument if occurrence not specified; otherwise optional. |
occurrence | The occurrence number of a header field, or the occurrence number of the header field matching fieldname, if fieldname is specified. This is an optional argument if fieldname is specified; otherwise it is required. |
start | Starting position within the field. This is an optional argument which defaults to 1. |
length | Length to return. This is an optional argument which defaults to the length of the header field. The length of a header field can be determined with $Web_Hdr_Len. |
Usage notes
- Even though "METHOD", "URL", "HTTP", and "ISINDEX" are not named HTTP header parameters, they are valid keywords for the $Web_Hdr_Parm fieldname parameter, returning these values:
METHOD The HTTP method associated with the request. URL The URL associated with the request. The value returned does not contain the protocol (http or https) or host name for the request, as these are not sent by the browser. The protocol (http or https) can be determined by the $Web_Secure function, and the host name sent by the browser can usually be retrieved with the HOST header parameter. The URL value will also not include the query parameters (the part after a question mark) though these can be retrieved via the ISINDEX header parameter. Alternatively, if you want to retrieve a relative URL including its query parameters, you can use $Web_Form_Action.
ISINDEX The query parameters in the URL. This is the part of the URL that comes after a question mark and typically has a name=value&name=value... format. For URL parameters in this format, the $Web_Isindex and $Web_URL_Parm functions provide an easy way of getting the components of the URL parameters. HTTP The version of HTTP requested by the browser. This is currently almost always going to be "1.1".
Examples
The following example places the value of each header parameter into a SOUL %variable of the same name.
* Stash the header values in matching fields. %method = $Web_Hdr_Parm( 'METHOD' ) %url = $Web_Hdr_Parm( 'URL' ) %version = $Web_Hdr_Parm( 'VERSION' )