procedure TNewFormFrame.Button1Click(Sender: TObject);
begin
inherited;
memo1.Lines.text := '';
RESTClient1.ResetToDefaults;
RESTClient1.Accept := 'application/json, text/plain; q=0.9, text/html;q=0.8,';
RESTClient1.AcceptCharset := 'UTF-8, *;q=0.8';
RESTClient1.BaseURL := 'http://api.ipstack.com/' + edit2.text;
RESTClient1.HandleRedirects := True;
RESTClient1.RaiseExceptionOn500 := False;
//here is were we pass the access_key and the additional parameters
RESTRequest1.Resource := Format('?access_key=%s', [edit1.Text]);
RESTRequest1.Client := RESTClient1;
RESTRequest1.Response := RESTResponse1;
RESTRequest1.SynchronizedEvents := False;
RESTResponse1.ContentType := 'application/json';
RESTRequest1.Execute;
memo1.Lines.text := RESTResponse1.Content;
end;
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.035290956497192 seconds