Код: Выделить всё
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, IdTCPConnection,
IdTCPClient, IdHTTP, IdBaseComponent, IdComponent, IdIOHandler,
IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL;
type
TForm2 = class(TForm)
Button1: TButton;
IdHTTP1: TIdHTTP;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm} {$DEFINE UNICODE}
procedure TForm2.Button1Click(Sender: TObject);
var
IdHTTP: TIdHTTP;
HTMLContent: string;
FileStream: TFileStream;
begin
IdHTTP := TIdHTTP.Create(nil);
try
IdHTTP.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(IdHTTP);
HTMLContent := IdHTTP.Get('https://forum.glgizma.ru/index.php');
FileStream := TFileStream.Create('index.htm', fmCreate);
try
FileStream.WriteBuffer(Pointer(HTMLContent)^, Length(HTMLContent));
finally
FileStream.Free;
end;
finally
IdHTTP.Free;
end;
end;
end.