$Web Hdr Parm: Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 14: Line 14:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>fieldname</th>
<tr><th>fieldname</th>
<td>The name of the header field, returned by $Web_Hdr_Name. Required argument if ''occurrence'' not specified, otherwise optional.</td></tr>
<td>The name of the header field, returned by <var>$Web_Hdr_Name</var>. Required argument if ''occurrence'' not specified, otherwise optional.</td></tr>
<tr><th>occurrence</th>
<tr><th>occurrence</th>
<td>The occurrence number of a header field, or the occurrence number of the header field matching ''fieldname'', if ''fieldname'' is specified. Optional argument if ''fieldname'' is specified, otherwise it is required.</td></tr>
<td>The occurrence number of a header field, or the occurrence number of the header field matching ''fieldname'', if ''fieldname'' is specified. Optional argument if ''fieldname'' is specified, otherwise it is required.</td></tr>
Line 20: Line 20:
<td>Starting position within the field. Optional argument which defaults to 1.</td></tr>
<td>Starting position within the field. Optional argument which defaults to 1.</td></tr>
<tr><th>length</th>
<tr><th>length</th>
<td>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.
<td>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 <var>$Web_Hdr_Len</var>.
</td></tr></table>
</td></tr></table>



Revision as of 22:17, 18 October 2012

<section begin="desc" />Value of request header field<section end="desc" />


$Web_Hdr_Parm retrieves the value of a request header field.

$Web_Hdr_Parm takes four arguments and returns a string, or null for any error condition.

Syntax

<section begin="syntax" />%string = $Web_Hdr_Parm( fieldname, occurrence, start, length ) <section end="syntax" />

Syntax terms

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. Optional argument if fieldname is specified, otherwise it is required.
start Starting position within the field. 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.

Notes

  • Even though "METHOD", "URL", and "HTTP" are not a named HTTP header parameters, if requested with $web_hdr_parm, the following will be returned for these names:
    METHODThe HTTP method associated with the request.
    URLThe URL associated with the request. It will not contain the protocol (http or https) or host name for the request as these are not sent by the browser. The protocol (http vs. https) can be determined by the $Web_Secure function and the host name sent by the browser can usually be retrieved via the "HOST" header parameter.
    HTTPThe 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 User Language %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' )

See also