Autor Beitrag
idefix123456
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Fr 17.12.10 12:04 
Hallo,

Ich suche jetzt schon vergebens nach einer function mit der ich einen JSON String von einer URL auslesen kann. Wer kann mir helfen? Danke



Bsp:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
function GetJsonString(url: string): string;

result := //Ausgabe des json strings

end;


// Ausgabe Testbeispiel:
Memo1.Text := GetJsonString('http://url.de/json');
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19341
Erhaltene Danke: 1752

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 17.12.10 12:12 
Wie wird der denn zurückgegeben? Ist das einfach der Text der Seite? Oder machst du auf der Seite noch etwas mit Skripten?

Einfach eine Seite abrufen geht mit Indy:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
uses
  IdHttp;

var
  HttpLoader: TIdHttp;
  PageContents: String;
begin
  HttpLoader := TIdHttp.Create;
  try
    PageContents := HttpLoader.Get('http://www.example.com');
  finally
    HttpLoader.Free;
  end;
end;
idefix123456 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Fr 17.12.10 12:24 
Habe es hinbekommen... Danke

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
function CheckUrl(url: string): string;
var
  HttpLoader: TIdHttp;
begin
  HttpLoader := TIdHttp.Create;
  try
    result := HttpLoader.Get(url);
  finally
    HttpLoader.Free;
  end;
end;