idHTTP 向网站发送json格式数据
var rbody:tstringstream; begin rbody:=tstringstream.Create('{"name":"lina"}') ; IdHTTP1.Request.Accept := 'text/javascript'; IdHTTP1.Request.ContentType := 'application/json'; IdHTTP1.Request.ContentEncoding := 'utf-8'; memo1.Text:=idhttp1.Post('http://127.0.0.1/idhttpjson.php', RBody); end;
发送普通格式
var Param:TStringList; begin Param:=TStringList.Create; Param.Add('name=lina'); memo1.Text:=IdHTTP1.Post('Http://127.0.0.1/idhttpjson.php', Param); end;
https://bbs.csdn.net/topics/390551578