program hai;
uses
wininet,
windows;
function Trim(const S: string): string;
var
I, L: Integer;
begin
L := Length(S);
I := 1;
while (I <= L) and (S[I] <= ' ') do Inc(I);
if I > L then Result := '' else
begin
while S[L] <= ' ' do Dec(L);
Result := Copy(S, I, L - I + 1);
end;
end;
function ReadInetFile(url: string): string;
var
NetHandle : HINTERNET;
UrlHandle : HINTERNET;
Buffer : array[0..1024] of char;
BytesRead : cardinal;
begin
Result := '';
if Copy(url, 1, 7) <> 'http://' then
url := 'http://' + url;
NetHandle := InternetOpen('Internet Explorer 18.0 SP26 with WM advisor', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
if Assigned(NetHandle) then
begin
UrlHandle := InternetOpenUrl(NetHandle, PChar(Url), nil, 0, INTERNET_FLAG_RELOAD, 0);
if Assigned(UrlHandle) then
begin
FillChar(Buffer, SizeOf(Buffer), 0);
repeat
Result := Result + Buffer;
FillChar(Buffer, SizeOf(Buffer), 0);
InternetReadFile(UrlHandle, @Buffer, SizeOf(Buffer), BytesRead);
until
BytesRead = 0;
InternetCloseHandle(UrlHandle);
end;
InternetCloseHandle(NetHandle);
end;
end;
procedure dure;
var
tmp: string;
begin
while true do
begin
tmp := ReadInetFile('http://твой_сайт.ру');
sleep(1000);
if trim(tmp) <> '' then
begin
MessageBox(0, pchar(trim(tmp)), 'получены данные с сайта', mb_ok);
exit;
end;
end;
end;
begin
dure;
end.