unit IdHTTPDemoVCLForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, System.ComponentModel;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses
  IdHTTP;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  LClient : TIdHTTP;
begin
  LCLient := TIdHTTP.create(nil);
  try
    if Edit2.Text <> '' then
      begin
      LClient.ProxyParams.ProxyServer := copy(Edit2.Text, 1, pos(':', Edit2.Text)-1);
      if pos(':', Edit2.Text) <> 0 then
        LClient.ProxyParams.ProxyPort := StrToInt(copy(Edit2.Text, pos(':', Edit2.Text)+1, $FF))
      else
        LClient.ProxyParams.ProxyPort := 80;
      end;
    Memo1.Lines.Text := LClient.Get(Edit1.Text);
  finally
    LCLient.Free;
  end;

end;

end.
