Hallo,
ich habe folgendes Problem:
Ich möchte per TIdHTTP Daten an einen Server schicken. Die URL, die ich ansprechen muss ist dabei mit einer .HTACCESS geschützt (HTTP Basic Authorization) und ich versuche momentan bei dem Event OnAuthorization Username und Password zu setzen.
Leider ohne Erfolg.
Ich bekomme nur einen HTTP-401 Fehler zurück, aber keine erfolgreiche Anmeldung.
Was mache ich falsch?
Quellcode:
[...]
procedure TForm1.FormCreate(Sender: TObject);
var liste: TStrings;
begin
IdHTTP1.Host := 'localhost';
IdHTTP1.Port := 80;
liste := TStringlist.Create;
liste.Add('var1=wert1');
liste.Add('var2=1234');
IdHTTP1.Post('http://server/request.php', liste);
Memo1.Lines.Add(IdHTTP1.ResponseText);
end;
procedure TForm1.IdHTTP1Authorization(Sender: TObject;
Authentication: TIdAuthentication; var Handled: Boolean);
begin
Memo1.Lines.Add('Authentication...');
Authentication.Username := 'max';
Authentication.Password := 'mustermann';
Handled := true;
end;
Vielen Dank für die Hilfe schonmal im Voraus.
Grüße
Robert Kummer
ich habe folgendes Problem:
Ich möchte per TIdHTTP Daten an einen Server schicken. Die URL, die ich ansprechen muss ist dabei mit einer .HTACCESS geschützt (HTTP Basic Authorization) und ich versuche momentan bei dem Event OnAuthorization Username und Password zu setzen.
Leider ohne Erfolg.
Ich bekomme nur einen HTTP-401 Fehler zurück, aber keine erfolgreiche Anmeldung.
Was mache ich falsch?
Quellcode:
[...]
procedure TForm1.FormCreate(Sender: TObject);
var liste: TStrings;
begin
IdHTTP1.Host := 'localhost';
IdHTTP1.Port := 80;
liste := TStringlist.Create;
liste.Add('var1=wert1');
liste.Add('var2=1234');
IdHTTP1.Post('http://server/request.php', liste);
Memo1.Lines.Add(IdHTTP1.ResponseText);
end;
procedure TForm1.IdHTTP1Authorization(Sender: TObject;
Authentication: TIdAuthentication; var Handled: Boolean);
begin
Memo1.Lines.Add('Authentication...');
Authentication.Username := 'max';
Authentication.Password := 'mustermann';
Handled := true;
end;
Vielen Dank für die Hilfe schonmal im Voraus.
Grüße
Robert Kummer
Comment