1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| procedure TForm1.Button1Click(Sender: TObject);
var
Fs : TFileStream;
begin
Fs := TFileStream.Create('c:\test.txt',fmCreate);
try
with TIdHTTP.Create(Application) do
try
try
Get('http://api.allocine.fr/rest/v3/search?partner=YW5kcm9pZC12M3M&filter=movie&count=50&page=1&q=Asterix', Fs);
except
On e : Exception do
MessageDlg(Format('Erreur : %s',[e.Message]), mtInformation, [mbOK], 0);
end;
finally
Free;
end;
finally
Fs.Free;
end;
if FileExists('c:\test.txt') then
Memo1.Lines.LoadFromFile('c:\test.txt');
end; |