I download a URL with IdHTTP.Get
, and I need to search the HTML tags and extract some data.
How I can convert the string that IdHTTP.Get
returns into an IHTMLDocument2
?
I Googled this problem and I can find a good code for this:
Idoc := CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
try
IDoc.designMode := 'on';
while IDoc.readyState <> 'complete' do
Application.ProcessMessages;
v := VarArrayCreate([0, 0], VarVariant);
v[0] := MyHTML;
IDoc.Write(PSafeArray(System.TVarData(v).VArray));
IDoc.designMode := 'off';
while IDoc.readyState <> 'complete' do
Application.ProcessMessages;
ParseHTML(IDoc);
finally
IDoc := nil;
end;
Regards