Web server
12.7 User-defined Web pages
Example: Reading a special variable with a Use clause
<!-- AWP_Out_Variable Name='HEADER:Status' Use='"Status"' -->
In this example, the HTTP special variable "HEADER:Status" receives the value of the PLC
tag "Status".
12.7.2.4
Writing special variables
The Web server provides the ability to write values to the CPU from special variables in the
HTTP request header. For example, you can store information in STEP 7 about the cookie
associated with a user-defined Web page, the user that is accessing a page, or header
information. The Web server provides access to specific special variables that you can write
to the CPU when logged in as a user with privileges to modify variables.
Syntax
<!-- AWP_In_Variable Name='<Type>:<Name>' [Use='<Varname>']-->
Parameters
<Type>
<Name>
<Varname>
1048
The type of special variable and is one of the following:
HEADER
SERVER
COOKIE_VALUE
Specific variable within the types defined above, as shown in these examples:
HEADER:Accept: content types that are acceptable
HEADER:User-Agent: information about the user agent originating the request.
SERVER:current_user_id: id of the current user; 0 if no user logged in
SERVER:current_user_name: name of the current user
COOKIE_VALUE:<name>: value of the named cookie
Enclose the Name clause in single quotation marks.
If no Use clause is specified, the special variable name corresponds to a PLC vari-
able name. Enclose the complete Name clause within single quotation marks and
the PLC tag in double quotation marks. The special variable name must match the
PLC tag name exactly.
Refer to HTTP documentation for a list of all the names of HEADER variables.
The variable name in your STEP 7 program into which you want to write the special
variable, which can be a PLC tag name, or a data block tag.
The Varname must be enclosed in single quotation marks. Within the single
quotes, use double quotation marks around a PLC tag or data block name. The
data block name is within the double quotes but not the data block tag name. Note
that for data block tags, you use the name of the block and not a data block num-
ber.
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK