本文整理自网络,侵删。
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中url的编码与解码,即urlencode的使用
更多相关阅读请进入《Delphi》频道 >>