Einzelnen Beitrag anzeigen

TheKleini666

Registriert seit: 4. Jun 2011
29 Beiträge
 
#1

Mit proxy verbinden (Indy)

  Alt 20. Sep 2011, 19:48
Hey,
also unsere Schule hat nen eigenen Proxy, mit den man dann Schul-HP's aufrufen kann, welche man normlaerweise nur aus schul PC's öffnen kan naja egal lange rede kruzer sinn:
Mein code funkt nicht :/

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdContext, IdBaseComponent, IdComponent, IdCustomTCPServer,
  IdTCPServer, IdCmdTCPServer, IdHTTPProxyServer, StdCtrls, IdTCPConnection,
  IdTCPClient, IdHTTP, ExtCtrls, IdAuthentication;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    GroupBox1: TGroupBox;
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    IdHTTP1: TIdHTTP;
    RadioGroup1: TRadioGroup;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    RadioButton6: TRadioButton;
    Button4: TButton;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Edit2: TEdit;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure IdHTTP1Connected(Sender: TObject);
    procedure IdHTTP1Disconnected(Sender: TObject);
    procedure IdHTTP1ProxyAuthorization(Sender: TObject;
      Authentication: TIdAuthentication; var Handled: Boolean);
  private

  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Lines.Add('Verbinden...');
  IdHTTP1.ProxyParams.ProxyServer := 'proxy.schule.com';
  IdHTTP1.ProxyParams.ProxyPort := 3259;
  IdHTTP1.Get('http://schule.com')
end;




procedure TForm1.IdHTTP1Connected(Sender: TObject);
begin
memo1.Lines.Add('Verbunden.');
button3.Enabled := True;
button2.Enabled := False;
end;

procedure TForm1.IdHTTP1Disconnected(Sender: TObject);
begin
memo1.Lines.Add('Disconnected.');
button3.Enabled := False;
button2.Enabled := True;
end;


procedure TForm1.IdHTTP1ProxyAuthorization(Sender: TObject;
  Authentication: TIdAuthentication; var Handled: Boolean);
begin
idhttp1.ProxyParams.ProxyUsername := edit1.Text;
  idhttp1.ProxyParams.ProxyPassword := edit2.Text;
end;

end.
doch ich bekomm immer error:
Proxy Authentication Required

aber ich hab doch Username und Passwort :O

ich hoffe ihr könnt mir helfen
Danke schon mal im Voraus
  Mit Zitat antworten Zitat