Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Tcheck.getCheck(url,key: string): Boolean;
- var
- list: TStringList;
- i: Integer;
- IdHttp1: TIdHttp;
- IdCookieManager11: TIdCookieManager;
- IdCompressorZLib1: TIdCompressorZLib;
- begin
- Result:=False;
- IdHttp1:=TIdHttp.Create(nil);
- IdCookieManager11:=TIdCookieManager.Create(nil);
- IdCompressorZLib1:=TIdCompressorZLib.Create(nil);
- IdHttp1.CookieManager:=IdCookieManager1;
- IdHttp1.Compressor:=IdCompressorZLib1;
- list := TStringList.Create;
- IdHttp1.HandleRedirects:=true;
- IdHTTP1.ConnectTimeout:=10000;
- IdHTTP1.ReadTimeOut:=10000;
- IdHTTP1.Request.UserAgent:= 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Dragon/36.1.1.21 Chrome/36.0.1985.97 Safari/537.36';
- IdHTTP1.Request.Connection:='Keep-Alive';
- IdHTTP1.Request.Referer:='www.google.com';
- IdHTTP1.Request.AcceptEncoding:='gzip,deflate,sdch';
- IdHTTP1.Request.AcceptLanguage:='ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4,uk;q=0.2';
- IdHTTP1.Request.Accept:='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
- IdHTTP1.IOHandler:=IdSSLIOHandlerSocketOpenSSL1;
- try
- list.Add(IdHTTP1.Get(url));
- if pos(key,list.Text)>0 then Result:=True;
- except
- Result:=False;
- end;
- FreeAndNil(IdHttp1);
- FreeAndNil(IdCookieManager1);
- FreeAndNil(IdCompressorZLib1);
- FreeAndNil(list);
- end;
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //применение
- if check.getCheck('https://vk.com/delphi_xe8','Хочешь забыть все на свете? Начни писать бот-программу:)') then showmessage('OK');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement