Advertisement
Gov_777

getCheck

Feb 12th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.58 KB | None | 0 0
  1. function Tcheck.getCheck(url,key: string): Boolean;
  2. var
  3. list: TStringList;
  4. i: Integer;
  5. IdHttp1: TIdHttp;
  6. IdCookieManager11: TIdCookieManager;
  7. IdCompressorZLib1: TIdCompressorZLib;
  8. begin
  9. Result:=False;
  10. IdHttp1:=TIdHttp.Create(nil);
  11. IdCookieManager11:=TIdCookieManager.Create(nil);
  12. IdCompressorZLib1:=TIdCompressorZLib.Create(nil);
  13. IdHttp1.CookieManager:=IdCookieManager1;
  14. IdHttp1.Compressor:=IdCompressorZLib1;
  15. list := TStringList.Create;
  16. IdHttp1.HandleRedirects:=true;
  17. IdHTTP1.ConnectTimeout:=10000;
  18. IdHTTP1.ReadTimeOut:=10000;
  19. 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';
  20. IdHTTP1.Request.Connection:='Keep-Alive';
  21. IdHTTP1.Request.Referer:='www.google.com';
  22. IdHTTP1.Request.AcceptEncoding:='gzip,deflate,sdch';
  23. IdHTTP1.Request.AcceptLanguage:='ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4,uk;q=0.2';
  24. IdHTTP1.Request.Accept:='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
  25. IdHTTP1.IOHandler:=IdSSLIOHandlerSocketOpenSSL1;
  26. try
  27. list.Add(IdHTTP1.Get(url));
  28. if pos(key,list.Text)>0 then  Result:=True;
  29. except
  30.    Result:=False;
  31. end;
  32. FreeAndNil(IdHttp1);
  33. FreeAndNil(IdCookieManager1);
  34. FreeAndNil(IdCompressorZLib1);
  35. FreeAndNil(list);
  36. end;
  37. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  38. //применение
  39. if check.getCheck('https://vk.com/delphi_xe8','Хочешь забыть все на свете? Начни писать бот-программу:)') then showmessage('OK');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement