procedure TFireThread.Execute;
var
Header,code,post:String;
sizex,indexx:Cardinal;
fBufing:array [1..1024] of byte;
ReadLen:Cardinal;
stoping:Boolean;
t:Cardinal;
f:file;
hurl,hinet,hRequest:HINTERNET;
begin
inherited;
sizex:=256;
indexx:=32;
stoping:=false;
post:='url='+Form1.sLabel22.Caption;
t:= Length(post);
Header:='Referer: http://www.freedebrid.fr/download'+#13+
'Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1' +#13+
'Accept-Language: ru,ru-RU;q=0.9,en;q=0.8 '+#13+
'Accept-Encoding:gzip, deflate'+#13+
'Connection: Keep-Alive '+#13+
'Content-Type: application/x-www-form-urlencoded';
hInet := InternetOpen('Opera/9.80 (Windows NT 6.1; U; ru) Presto/2.10.229 Version/11.60',
INTERNET_OPEN_TYPE_PRECONFIG,
nil,
nil,
0);
hUrl:=InternetConnect(hInet,PChar('www.freedebrid.fr'),INTERNET_DEFAULT_HTTP_PORT,nil,nil,INTERNET_SERVICE_HTTP,0,0);
hRequest:=HttpOpenRequest(hURL,'POST',pchar('/download'),'HTTP/1.1',nil,0,0,0);
HttpSendRequest(hRequest,PChar(Header),Length(Header),PChar(post),t);
Form1.sRichEdit1.Lines.Add(Header);
AssignFile(f,ExtractFilePath(Application.ExeName)+'firebird.html');
Rewrite(f,1);
while stoping=false do
begin
InternetReadFile(hRequest, @fBufing, SizeOf(fBufing), ReadLen);
Form1.sRichEdit2.Lines.Add('Прочитанно'+' '+IntToStr(ReadLen));
if ReadLen=0 then begin
stoping:=true;
end else begin
BlockWrite(f, fBufing, ReadLen);
end;
end;
CloseFile(f);
InternetCloseHandle(hUrl);
InternetCloseHandle(hInet);
Terminate;
end;