CheckAvailability

Checks the availability of the specified page. Terminates performing of the task, if the page was unavailable.

Syntax

procedure CheckAvailability(aPage: string; aExpectedIP: string = '0.0.0.0';
  aIncludedText: string = ''; aUserAgent: string = ''); overload;
procedure CheckAvailability(aCheckItem: TCSCheckItem); overload;
procedure CheckAvailability(aCheckItems: TCSCheckItems); overload;

Parameters

  • aPage
    • type: string
    • functions: verified page
  • aExpectedIP
    • type: string
    • functions: supposed IP host on which the page is situated
  • aIncludedText
    • type: string
    • functions: text contained in the source code of the checked page
  • aUserAgent
    • type: string
    • functions: User-agent, which will be specified when loading the source code of the checked page
  • aCheckItem
    • functions: record containing the information required to verify the page
  • aCheckItems
    • functions: array of records to check multiple pages

Notes

  • To test the page goes through the following algorithm:
    1. verified the availability of the host on which the page is situated. If the host is available, then
    2. if IP host coincides with aExpectedIP or aExpectedIP and equals '0 .0.0.0 ', then
    3. if aIncludedText not empty, the source code of the page is loaded using aUserAgent (redirects are not supported!). If aUserAgent empty, then used User-agent, installed for your browser. If the source code of the page contains aIncludedText or aIncludedText - empty string, then
    4. test passes, the script continues to execute
  • If the test fails, the script will stop execution
  • The procedure may be performed only once, and only being the first method that performed by a script. If there were performed other methods before, the software will ignore CheckAvailability.
  • If you check the array pages, will be checked only the first five elements of array

Examples

  1. CheckAvailability('habrahabr.ru');
  2. CheckAvailability('habrahabr.ru', '178.248.233.33');
  3. CheckAvailability('habrahabr.ru', '178.248.233.33', 'habr');
  4. var CheckItem: TCSCheckITem;
    CheckItem.Page := 'habrahabr.ru';
    CheckAvailability(CheckItem);
  5. var CheckItems: TCSCheckITems;
    var CheckItem: TCSCheckItem;
    CheckItem.Page := 'habrahabr.ru';
    CheckItem.ExpectedIP := '178.248.233.33';
    CheckItems.Add(CheckItem);
    CheckAvailability(CheckItems);