Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup - HTTP request - Get www/web content

Tags:

Could some one tell me how can I get www content in Pascal Code in Inno Setup Script?

Regards,
Tomasz

like image 828
Tomasz Filipek Avatar asked Mar 15 '17 09:03

Tomasz Filipek


1 Answers

Use WinHttpRequest class:

var
  WinHttpReq: Variant;
begin
  WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
  WinHttpReq.Open('GET', 'https://www.example.com/', False);
  WinHttpReq.Send('');
  if WinHttpReq.Status <> 200 then
  begin
    Log('HTTP Error: ' + IntToStr(WinHttpReq.Status) + ' ' +
        WinHttpReq.StatusText);
  end
    else
  begin
    Log('HTTP Response: ' + WinHttpReq.ResponseText);
  end;
end;
like image 100
Martin Prikryl Avatar answered Sep 24 '22 09:09

Martin Prikryl