Hello,
Thanks, but it doesn't work. The result are some unknown characters. Seems pointer info to me..
I'll keep trying. Any other suggestions???
Greetings,
Delphi-Lover.
There the code:
Delphi-Quellcode:
procedure TfrmReceiveXML.GetXMLFromWeb;
function Document_GetHTML(Document: IDispatch):string;
var
ms: TStringStream;
begin
Result := '';
if Assigned(Document) then
begin
ms := TStringStream.Create(Result);
try
OleCheck((Document as IPersistStreamInit).Save(TStreamAdapter.Create(ms),False));
Result := ms.DataString;
finally
ms.Free;
end;
end;
end;
var
IEApp, varXMLReturn: OLEVariant;
HeaderStr, EncodedStr, strXMLReturn : string;
Post: OleVariant;
nIdx: Integer;
begin
HeaderStr:='Content-Type: application/x-www-form-urlencoded' + #10#13;
EncodedStr:='vl_xml='+HTTPEncode(MyMsg);
Post:=VarArrayCreate([0,Length(EncodedStr)-1],varByte);
for nIdx:=1 to Length(EncodedStr) do Post[nIdx-1]:=Ord(EncodedStr[nIdx]);
IEApp:=CreateOLEObject('InternetExplorer.Application');
IEApp.Navigate('https://website.com/getdata.asp','','',Post, HeaderStr);
While (IEApp.ReadyState<>4) or (IEApp.Busy) do
begin
Application.ProcessMessages;
end;
strXMLReturn:=Document_GetHTML(IEApp.Document);
Memo1.Text:=strXMLReturn;
Memo1.Lines.SaveToFile('ReturnXML.xml');
{ This will work, but with the problem }
//varXMLReturn:=IEApp.document.body.InnerText; {or InnerHTML}
//strXMLReturn:=varXMLReturn;
//Memo1.Text:=strXMLReturn;
//Memo1.Lines.SaveToFile('ReturnXML.xml');
}
end;