function GetdataAsp(AspName:string; StrSql:String):WideString; begin try ConnectUrl := 'Http://'+ConnectIni+AspName; ReSult := postXml(StrSql,ConnectUrl); except on Ex:exception do begin ShowMessage(Ex.Message); assignfile(ErrorF,ExtractFilePath(Application.exename)+'ErrorMessage.txt'); Append(ErrorF); try writeln(ErrorF,DateTimeToStr(now)+' | '+Ex.Message); finally closefile(ErrorF); end; end; end; end;
function postXml(const xmlstr, url: WideString): WideString; var idHttp:TIdHTTP; sends:tstrings; IdEncoderMIME1:TIdEncoderMIME; vStream: TMemoryStream; begin result:=''; try idHttp:= TIdHTTP.Create(nil); idHttp.Request.ContentType := 'application/x-www-form-urlencoded'; idhttp.Request.AcceptCharSet := 'UTF-8'; idhttp.Request.AcceptEncoding := 'UTF-8'; idhttp.Request.AcceptLanguage := 'UTF-8'; sends:=tstringlist.Create; sends.Add('strSQL='+(xmlstr)); result:=idhttp.Post(url,sends); except on Ex:exception do begin assignfile(ErrorF,ExtractFilePath(Application.exename)+'ErrorMessage.txt'); Append(ErrorF); try writeln(ErrorF,DateTimeToStr(now)+' | '+Ex.Message); finally closefile(ErrorF); end; end; end; idHttp.Free; sends.Free; end;
----------------------------------------------
-