{INCLUDE _LOGOS_C.HTM}

Using HTTP Header Fields

When a web browser retrieves a web page, a number of HTTP header fields are included with each page request.  These fields vary from browser to browser, but can be used by Coyote applications to control page processing. Here is an example of the HTTP header fields that are sent to the Coyote web server by your browser:
|RAW(PL_AMTOCRLF(HDR.TBL))|


This table is built live with the actual values that your browser generated.  It is also possible that any intervening HTTP proxy server may have also added header fields.

There are two basic techniques for querying HTTP header fields. You can query single fields with the statement:

PL_GET_HDR var FROM 'field name' ELSE ...
An example of using this statement is here:
PL_GET_HDR USER.AGENT FROM 'USER-AGENT' ELSE USER.AGENT = 'Undefined'
Your user-agent is:  |USER.AGENT|
This statement is ideal for specifically querying a single header field value.  If you want to see all of the values, you can look directly at the Coyote common variables where these values are stored:
ST$HTTP.HDR This is a dynamic array of values that contains the names of each existing header field.  If the same header field name occurs multiple times, then only a single entry in the ST$HTTP.HDR variable will be entered.
ST$HTTP.VAL This is a dynamic array of values that contains the values of each existing header field.  If the same header field name occurs multiple times, then each instance will be stored as a seperate sub-value in this variable.
If you would like to see how this page queries the HTTP headers, you can look here.

{INCLUDE _GEN_FTR.HTM}

PicLan-IP/BASIC | |
*
      V = ''
      I1 = DCOUNT(ST$HTTP.HDR,VM)
      FOR I = 1 TO I1
         V<-1> = ST$HTTP.HDR<1,I>
         V<-1> = ST$HTTP.VAL<1,I,1>
      NEXT I

      CALL PLH.BLD.TABLE('Q','BORDER CELLSPACING=0 CELLPADDING=2',2,'',V,'',HDR.TBL)

      PL_GET_HDR USER.AGENT FROM 'USER-AGENT' ELSE USER.AGENT = 'Undefined'