Log In Register
c
The code below will download a Wikipedia article about tigers.

uses ..., fphttpclient, fpjson;

...

var Json: TJSONData;
    HTTP: TFPHttpClient;
    Result, Amount, FromCurrency, ToCurrency: String;
begin
  try
    Amount := '123.45';
    FromCurrency := 'EUR';
    ToCurrency := 'USD';
    HTTP := TFPHttpClient.Create(Nil);
    Result := HTTP.Get('http://api.rest7.com/v1/currency_convert.php?amount=' + Amount + '&currency_in=' + FromCurrency + '&currency_out=' + ToCurrency);
    Json := GetJSON(Result);
    Memo1.Lines.Add(Format('Result=%f %s', [Json.GetPath('amount').AsFloat, Json.GetPath('currency_out').AsString]));
  finally
    HTTP.Free;
  end;