{INCLUDE _BAS_HDR.HTM}

7.  Special Statements and Functions

In order to make it easier to build HTML documents and handle form input, a number of special BASIC statement and function extensions are available to your embedded Pick BASIC code:

7.1 Reading HTTP Header Fields

HTTP header fields are available to embedded MV/Basic code using the helper function: This statement will stores into variable VAR the string associated with the HTTP header fields "USER-AGENT".  If the "USER-AGENT" fields is not present, then the ELSE clause will execute.  If more than one header field is tagged as "USER-AGENT", then VAR will contain each value as multiple MV attributes.  HTTP header field names (but not values) are also automatically converted to UPPER CASE.
If you wish to access all of the HTTP header fields, you can query the variables ST$HTTP.HDR and ST$HTTP.VAL.  The ST$HTTP.HDR variable contains all of the header field names in a multi-valued dynamic array.  The ST$HTTP.VAL variable contains all of the associated header field values in a multi-valued dynamic array with duplicate entries stored as sub-values.  This data is stored in this manner so that applications can use the MV/Basic LOCATE(...) statement to quickly query a header value without having to search through a list.

7.2 Generating HTTP Header Fields

You can specify additional HTTP header fields within embedded MV/Basic code.  The following statement will add an HTTP header line: This example will add an HTTP "Location: ..." header field.  You can add whatever HTTP header fields you application needs.  In general, the following two types of fields can be used:

7.3 COOKIES

The PicLan-IP Web Server provides several functions that make setting and retrieving cookie values easy.
To set a COOKIE, include the following statement in your embedded MV/Basic code: To read a cookie use the statement: The PL_SET_COOKIE helper function uses the default, non-persitant, cookie mechanism.  If you want to use all of the features of cookies, you can specify the Set-Cookie HTTP header manually as in: More information on cookies is available in NetScape's cookie specification:
http://home.netscape.com/newsref/std/cookie_spec.html
{INCLUDE _BAS_FTR.HTM}