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 getwindowhandle

Delphi idhttp 断开连接/超时读取

Delphi抓屏代码

dephi获取系统常量

Delphi+mysql:tadoquery使用插入中文乱码解决方法

Delphi 遍历目录

Delphi 自定义产生随机字符串函数

Delphi生成随机字符串

Delphi提取任意长度随机数

Delphi 中 tjpegimage 中的一处问题修复

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



打赏

取消

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

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

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

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

评论

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