本文整理自网络,侵删。
var IdHTTP1:TIdHTTP; postStream : TStringStream; Wstr:WideString;
res:WideString;begin IdHTTP1 := TidHTTp.create(nil); try Wstr:= 'aaccount=' + aaccount; Wstr:=Wstr+'&'+'passwd=' +passwd; postStream:=TStringStream.Create(ansitoUTF8(Wstr)); IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded'; try res:=Utf8ToAnsi(IdHTTP1.Post(infoURl,postStream)); except on E:Exception do begin MsgBox('错误信息:' +e.message); end; end; vJson := SO(res); end;
用stringlist POST提交时会乱码,改用该方法后解决。
来源:https://blog.csdn.net/weixin_30622181/article/details/95023193
相关阅读 >>
Delphi windows 编程[10] - wm_lbuttondown、wm_lbuttonup 和 wm_mousemove 消息
Delphi 读取图像文件base64编码加载到image组件显示图片
Delphi 获取窗口矩形的四种方法: getclientrect、clientrect、getwindowrect、boundsrect
Delphi systemparametersinfo 用法
Delphi 能否把.txt文件的数据导入到access数据库中
更多相关阅读请进入《Delphi》频道 >>