Query and evaluation of web pages and IP devices
Contents
This function allows the sending of randomly structured data via a TCP/IP connection as well as the evaluation of response data. Sending and receiving is not limited to pure text (e.g. HTTP commands), but rather also enables working with binary data.

Data can be evaluated in two different ways:
In order to initiate the retrieval and evaluation of a web page/IP device, the command type "Evaluate web page/IP device" is available under Commands. The last requests are partly logged on the debug page in the Event-BiDir section. See also the chapter Important information.

1.Application

1.2.Importing and exporting libraries

Completed queries can be saved as libraries and used again in other projects with the functions Library -> Import library (right-click on root element in tree view, left) and Library -> Export library (right-click on element in tree view, left). Optionally, you can export individual queries or a complete folder including sub-folders. If a library contains several requests, these are always imported with a maximum depth from one folder. This means one folder at maximum is created, and all the requests that may be underneath in further subfolders are assigned to it. All queries can then be found in this folder.

The IP/host address, IP port, user name and passwords can be entered for all queries during the import procedure. For this, the data is suggested that is found in the library to be imported from the HS/FS-Expert. All the imported elements are pre-assigned these values. Different fields can be active depending on the content of the library. The fields "User name" and "Password" are, for example, only active in the cases where an HTTP query with password protection is available in the library.

If further objects are used in the library (e.g. communication objects, sequences, etc.), a project-specific implementation has to be carried out in the "Objects" tab. On the basis of the object description and the type, you can recognise which function the object has.

1.3.Important notes

The HS/FS can receive and evaluate data up to a maximum size of 500,000 bytes. Data outside this range cannot be utilised.

The debug page supplies information to test a web query. In the section Event-BiDir, all the queries/evaluations carried out are listed with the following information:
  • Date and time of the query (Host IP address) (Host IP port)
  • Send: The number of characters sent, including display of the first character as hex values, afterwards in plain text (ASCII values)
  • Recv: The number of characters received, including display of the first character as hex values, afterwards in plain text (ASCII values)
  • Total: The number of defined data blocks
  • Work: The number of data blocks to be processed.
  • Type:
    - List: simple evaluation was configured
    - RegExp: complex evaluation was configured
  • OK:
    - 1 = evaluation successful
    - 0 = evaluation failed.

2.Data

Name
The query/evaluation is maintained under this term in the HS/FS Expert.
IP/host address
Address of the TCP/IP other party. (E.g. www.example.com or 192.168.0.1)
IP port
Port number of the service of the other party.
Telegram type
There are two selection options:
  • TCP: The connection via the port specified above requires a connection via the TCP protocol.
  • TCP/TLS: The connection via the port specified above requires an encrypted connection according to the TLSv1.2 protocol.
The default value is TCP.
End connection after a certain amount of data is received
Yes: The HS/FS ends the connection prematurely after receiving the number of characters specified in the field Max. length of the response.
No: The HS/FS waits until the other party ends the connection or the maximum possible size of bytes has been received.
Note
We recommend this option if the other party does not terminate the connection, or, for example, in a web page only the first n-characters are of significance and the rest of the data can be discarded.
Important
If this option is not activated, the HS/FS sets the value automatically to the maximum size of 500,000 bytes.

3.Send

The following options are available in order to send data to the opposite party:
Send HTTP call
Calls a web page from the other party. The HS/FS Expert automatically creates the suitable data blocks, whereby a GET command is always generated.
Note
If "TCP/TLS" is selected as Telegram type, an encrypted connection (HTTPS) is used.

On the debug page, the last telegrams sent and the respective response can be viewed in the section "Event-BiDir". See also the chapter Important information.
URL (path only)
Path of the web page (e.g. /countries.html). You can integrate placeholders for communication objects in the URL. You can structure the entries variably in this way. Instead of a value, apply the group address of a communication object, enclosed by curly brackets.
Example: In order to read out the country from the communication object with the group address 100/1, instead of making a fixed entry, write "/countries?name={100/1}".
Note
If you require curly brackets in your URL, instead of wanting to enter a placeholder, use the following HTML codes instead of the brackets:
- For '{' (Open) = '{'
- For '}' (Close) = '}'
Convert URL
Yes: The specified URL is coded in accordance with the HTTP standard.
Example: The URL /tic tac toe.html then becomes /tic%20tac%20toe.html
No: The data are sent to the web server in the same way they were entered.
Password protection
Yes: The web page is secured by a HTTP password protection.
No: The web page can be called up without user name and password.
User name
User name for authentication. Only necessary if the password protection option is activated.
Password
Password for authentication. Only necessary if the password protection option is activated.

3.1.Send data blocks

Data blocks can be defined in this list. The data blocks are sent to the other party in the defined sequence.

4.Receiving

The following information differs depending on whether a simple or complex evaluation is to be carried out:

4.1.Receiving (simple evaluation)

The result of the sent request is evaluated in this input screen. The data blocks to be received are defined in this list.

4.2.Receiving (complex evaluation)

If a complex telegram was defined during saving, the definition of a regular expression is necessary. The following field is used for this. The defined data blocks are dependent on the regular expression.
Regular expression
Defines the regular expression which is used to evaluate the telegram.

5.Commands

Commands can be executed in conjunction with the evaluation of the response data. A difference is made between successful and failed evaluations.
Note
The commands for failed evaluations are especially suited as an indication of changed structures within a web page.

No commands are executed in the case of a failed connection. For troubleshooting, the section Event-BiDir is available on the debug page. See also the chapter Important information.