====== 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//** * //type:// [[en:wascript:pascal:records:tcscheckitem]] * //functions:// record containing the information required to verify the page * **//aCheckItems//** * //type:// [[en:wascript:pascal:types:tcscheckitems]] * //functions:// array of records to check multiple pages ===== Notes ===== * To test the page goes through the following algorithm: - verified the availability of the host on which the page is situated. If the host is available, then - if IP host coincides with aExpectedIP or aExpectedIP and equals '0 .0.0.0 ', then - 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 - 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 ===== - CheckAvailability('habrahabr.ru'); - CheckAvailability('habrahabr.ru', '178.248.233.33'); - CheckAvailability('habrahabr.ru', '178.248.233.33', 'habr'); - var CheckItem: TCSCheckITem; CheckItem.Page := 'habrahabr.ru'; CheckAvailability(CheckItem); - var CheckItems: TCSCheckITems; var CheckItem: TCSCheckItem; CheckItem.Page := 'habrahabr.ru'; CheckItem.ExpectedIP := '178.248.233.33'; CheckItems.Add(CheckItem); CheckAvailability(CheckItems);