本文整理自网络,侵删。
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 stringgrid 实例5 本例功能:字体修改为居中,红色,20号
Delphi实现win10下Delphi 10.3.1 inline hook 域名转向之internetconnecta
更多相关阅读请进入《Delphi》频道 >>