Inno Setup - HTTP request - Get www/web content

前端 未结 1 671
死守一世寂寞
死守一世寂寞 2021-01-15 06:45

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

Regards,
Tomasz

相关标签:
1条回答
  • 2021-01-15 07:05

    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;
    
    0 讨论(0)
提交回复
热议问题