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

相关文章:

  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2021-12-31
  • 2021-06-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案