function Generate_DZ_TYZL(
ATYXML: string): WideString;
var
xml:string;
mwXML,iTYXML:string;
begin
iTYXML:=StringReplace(ATYXML,#$D#$A,'',[rfReplaceAll]);
xml:='<?xml version="1.0" encoding="gbk"?>';
xml:=xml+'<business comment="税控盘通用指令" id="SKPCOMMAND">';
xml:=xml+'<body yylxdm="1">';
xml:=xml+'<input>';
xml:=xml+'<FPXML>:FPXML</FPXML>';
xml:=xml+'</input>';
xml:=xml+'</body>';
xml:=xml+'</business>';
mwXML:=xml;
xml:=StringReplace(xml,':FPXML',EncodeString(AnsiToUtf8(ATYXML)),[rfReplaceAll]);
xml:=StringReplace(xml,#$D#$A,'',[rfReplaceAll]);
result:=StringReplace(EncodeString(AnsiToUtf8(xml)),#$D#$A,'',[rfReplaceAll]);
end;
function Generate1(
ATYXML: string): WideString;
var
xml:string;
mwXML,iTYXML:string;
begin
// iTYXML:=StringReplace(ATYXML,#$D#$A,'',[rfReplaceAll]);
iTYXML:=StringReplace(ATYXML,#13#10,'',[rfReplaceAll]);
// result:=StringReplace(EncodeString(AnsiToUtf8(iTYXML)),#$D#$A,'',[rfReplaceAll]);
result:=StringReplace(EncodeString(AnsiToUtf8(iTYXML)),#13#10,'',[rfReplaceAll]);
end;
function request(const url:string;params:TStringStream;timeout:integer;var iserror:boolean):string;
var IdHttp2:TIdHTTP;
begin
IdHttp2:=TIdHTTP.Create(nil);
try
IdHTTP2.ReadTimeout:=timeout;
// IdHTTP2.Request.ContentType:= 'application/x-www-form-urlencoded';
IdHTTP2.Request.ContentType:= 'text/html';
result:='';
try
iserror:=false;
result:=IdHTTP2.Post(url, params);
except
on e:Exception do begin
result:=e.Message;
iserror:=true;
end;
end;
finally
IdHttp2.Free;
end;
end;