本文整理自网络,侵删。
从国外网站抄来的代码
Delphi source:
http := TIdHttp.Create(nil);
http.HandleRedirects := True;//允许头转向
http.ReadTimeout := 5000;//请求超时设置
http.Request.ContentType := 'application/json';//设置内容类型为json
jsonToSend := TStringStream.Create('{"name":"Peter Pan"}');//创建一个包含JSON数据的变量
jsonToSend.Position := 0;//将流位置置为0
Memo1.Lines.Text := http.Post('http://www.website.com/test.php', jsonToSend);//用MEMO控件接收POST后的数据返回
jsonToSend.free;http.free;//用完记得释放
相关阅读 >>
windows api 的数据类型与 Delphi 数据类型对照表
Delphi 提升进程权限到sedebugprivilege
Delphi recodedatetime、recodedate、recodetime、recodeyear ... 修改时间
Delphi 取得开机时间 开机时间总长度(可精确到秒,分钟等)
更多相关阅读请进入《Delphi》频道 >>