本文整理自网络,侵删。
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 dateof、timeof、yearof、monthof、weekof、dayof、hourof、minuteof、secondof、millisecondof �c 提取时间成分
Delphi Delphi中点击dbgrid某一行获得其详细数据方法
更多相关阅读请进入《Delphi》频道 >>