Delphi REST API Post Sample


本文整理自网络,侵删。

 procedure TForm1.Button1Click(Sender: TObject);
var
  jsonToSend: TStringList;
  http: TIdHTTP;
begin
  http := TIdHTTP.Create(nil);
  try
    http.HandleRedirects := True;
    http.ReadTimeout := 5000;
    jsonToSend := TStringList.create;
    try
      jsonToSend.Add('{ Your JSON-encoded request goes here }');
      http.Post('http://your.restapi.url', jsonToSend);
    finally
      jsonToSend.Destroy;
    end;
  finally
    http.Destroy;
  end;
end;

相关阅读 >>

Delphi 只限制到4位小数级别

Delphi 时间控制窗口标题栏文字或任务栏标题文字滚动

Delphi 中的常用事件

Delphi中url的编码与解码,即urlencode的使用

Delphi中关闭“返回值…可能未定义”的警告

Delphi 禁用启用网卡

Delphi nethttpclient1 数据库查询

Delphi 在消息窗口中显示进度条

Delphi 验证tstrings是否存在

Delphixe5如何获取android手机sim卡串号

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...