Delphi IdHTTP1 XMLPOST


本文整理自网络,侵删。

 
function XMLPOST(url, postdata: String): String;
var
  GonderilecekVeri: TStrings;
  DonecekSonuc: TStringStream;
  XmlString, aa: string;
  IdHTTP1: TIdHTTP;
begin
  try
    try
      try
        GonderilecekVeri := TStringList.Create;
        GonderilecekVeri.Text := postdata;
        XmlString := '';
        DonecekSonuc := TStringStream.Create('');
        IdHTTP1 := TIdHTTP.Create(nil);
        IdHTTP1.HTTPOptions := [];
        IdHTTP1.ReadTimeout := 30000;
        IdHTTP1.Disconnect;

        // Bu kodlar? ekledi?imde de durum ayn? 
{
IdHTTP1.Request.ContentType := 'text/xml';
IdHTTP1.Request.AcceptEncoding := 'iso-8859-9';
IdHTTP1.Request.ContentEncoding := 'iso-8859-9';
IdHTTP1.Request.AcceptLanguage:='tr';
IdHTTP1.Request.ContentLanguage:='tr';
 IdHTTP1.Request.AcceptCharSet:='iso-8859-9';
 IdHTTP1.Request.CharSet:='iso-8859-9';
}


        IdHTTP1.Post(url, GonderilecekVeri, DonecekSonuc);
        IdHTTP1.Disconnect;
        XmlString := DonecekSonuc.DataString;
        result := XmlString;
      except
        on e: exception do
        begin
          // mesajpost('logyaz','xmlpost hata '+e.Message);
        end;
      end;
    finally
      begin
        DonecekSonuc.Free;
        GonderilecekVeri.Free;
        IdHTTP1.Disconnect;
        FreeAndNil(IdHTTP1);
      end;
    end;
  except
  end;
end;

相关阅读 >>

Delphi winsock 获取计算机名和ip

Delphi多线程学习:多线程数据库查询(ado)

Delphi 根据年份获取年干支

Delphi tfont类型和json互相转换的函数

Delphi数组之菜鸟篇

Delphi的tfilestream 内存流

Delphi sender 的用法举例

Delphi xe7检查android蓝牙权限

Delphi如何获取硬盘所有的分区容量

Delphi for 循环 to和downto的理解

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...