Advertisement
Gov_777

Проверить URL

Sep 16th, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.55 KB | None | 0 0
  1. function GetUrl(const url: string): Boolean;
  2. var
  3. HTTP: TIdHTTP;
  4. begin
  5.   Result := False;
  6.   HTTP:=TIdHTTP.create;
  7.   HTTP.ConnectTimeout:=60000;
  8.   HTTP.ReadTimeOut:=60000;
  9.   HTTP.HandleRedirects:=false;
  10.   try
  11.     HTTP.Get(url);
  12.     if HTTP.ResponseCode = 200 then
  13.       Result := True;
  14.   except
  15.     Result := False;
  16.   end;
  17.   FreeAndNil(HTTP);
  18. end;
  19. //применение
  20.    while not GetUrl('http://www.***************.com') do begin
  21.    LabelB2.Caption:='Сервер не доступен!';
  22.    Application.ProcessMessages;
  23.    Sleep(50);
  24.    end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement