The example demonstrates the evaluation of a website. The URL for the call could be http://www.example.net/weather.php?postcode=12345, for example. The web server would reply with an HTML page containing weather data. The entire data communication could then contain the following data, for example:
-- SEND: --
The specified URL does not exist. This data is used as an example only.
The following data must be defined in the HS/FS Expert:
-- SEND: --
GET /wetter.php?plz=12345 HTTP/1.1
Host: www.example.net
Connection: Close
-- RECEPTION: --HTTP/1.1 200 OK
Content-Type: text/html
Connection: Close
<html>
<body>
<h1>Current weather data for London!</h1> <table border="1">
<tr>
<td>Temperature:</td><td>15 °C</td> </tr>
<tr>
<td>Wind direction:</td><td>North</td> </tr>
</table>
</body>
</html>
-- END -- The specified URL does not exist. This data is used as an example only.
The following data must be defined in the HS/FS Expert:
1.General data
The following settings must be made in the "Data" tab:
Designation: free selectable
Host: www.example.net
IP port: 80
Designation: free selectable
Host: www.example.net
IP port: 80
2.Send the query
There are two options for sending a query on the "Send" tab.
On the one hand, the "Send HTTP call" option can be selected; in this case the HS/FS Expert generates the required data blocks automatically during transmission. The data blocks themselves do not need to be defined here. The post code would be fixed here, however:
On the one hand, the "Send HTTP call" option can be selected; in this case the HS/FS Expert generates the required data blocks automatically during transmission. The data blocks themselves do not need to be defined here. The post code would be fixed here, however:
- URL (path only): /weather.php?postcode=12345
In addition, the required data blocks themselves can also be defined; in this case, a dynamic post code can be sent:
- Block 1
Type: Text
Free text: GET /weather.php?postcode= - Block 2
Type: Value as plain text
Activate communication object containing the desired post code
Use URL quoting - Block 3
Type: Text
Free text: HTTP/1.1
The Attach CR and Attach LF fields must be activated. There must be a space before HTTP. Explanation: The other party is notified as to which file is to be called up via a so-called GET command. Since parameters, in addition to the file name, are transferred, the first line of the HTTP command must be divided into multiple data blocks. - Block 4
Type: Text
Free text: Host name: www.example.net
The Attach CR and Attach LF fields must be activated.
Explanation: The other party must also be notified of the address under which the file was downloaded. - Block 5
Type: Text
Free text: Connection: Close
The Attach CR and Attach LF fields must be activated.
Explanation: The other party wants to know whether or not the connection is to remain open after the data is sent. - Block 6
Type: Text
Free text:
The Attach CR and Attach LF fields must be activated.
Explanation: An empty line must be sent at the end of the query.
Note
Each data block must end with CR and LF.
3.Receive and evaluate the response
The following data blocks would then have to be defined on the "Receive" tab:
- Block 1
Type: Any desired quantity of data
Explanation: The initial data is not important for the evaluation, so they can be ignored. - Block 2
Type: Text
Value:Temperature:
Explanation: This block is used to identify the temperature.- Block 3
Type: Value as plain text
Communication object for the current temperature
Explanation: The temperature is expected after "block 2"; everything up to the next block is written to the communication object.- Block 4
Type: Text
Value: °C
Explanation: The end of the value is reached with this block. All data between "block 2" and "block 4" is identified as the temperature. Spaces, tabs and line breaks are removed. - Block 3
- Block 5
Type: Any desired quantity of data
Explanation: The following data is not important for the evaluation, so it can also be ignored. - Block 6
Type: Text
Value: Wind direction:
Explanation: This block is used to identify the wind direction.- Block 7
Type: Text from the predefined list
List: #North#East#South#West#
Explanation: see block 8- Block 8
Type: Text
Value:
Explanation: The identification for block 7 ends here. The identified value between "block 6" and "block 8" ("North" in this example) is sought in the list defined in block 7. The value is found at position 1 in the list, which is why value 1 is written to the communication object. - Block 7
- You're done!
Processing complete. The commands for successful processing are now executed.