Einzelnen Beitrag anzeigen

MartinK

Registriert seit: 21. Jun 2009
Ort: Germering (Germany)
89 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#3

AW: Daten abholen von einem CakePHP Server

  Alt 5. Okt 2014, 05:38
Danke für Deinen Hinweis Valetin!

Ich habe durch etwas "rumprobieren" nun die Lösung einer erfolgreichen Anmeldung bei CakePHP mit INDY Bordmittel herausgefunden.
Wenn jemand anders das mal braucht -> voila

Delphi-Quellcode:
Var
  iDHTTP: TIdHttp;
  jsonData, Response: String;
  aUsername,aPassword : String;

begin

  aUsername := 'FirstName.LastName@email.com';
  aPassword := 'FictivePW0123455678';

  IdHttp := TIdHttp.Create(nil);

  iDHTTP.Request.BasicAuthentication := True;
  iDHTTP.Request.Authentication := TIdBasicAuthentication.Create;
  iDHTTP.Request.Authentication.Username := aUsername;
  iDHTTP.Request.Authentication.Password := aPassword;
  IdHTTP.Request.ContentType := 'application/json';
  jsonData := 'http://myhomepage.de/somecommand/changed.json?date=1970-01-01 00:00:00';
  Response := IdHttp.Get(jsonData);

  IdHTTP.Free;
end;
LG Martin
Martin Kuhn
  Mit Zitat antworten Zitat