....
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Mshtml, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP;
type
TForm1 =
class(TForm)
IdHTTP1: TIdHTTP;
Button1: TButton;
EdURL: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure ExtractLinks(doc: IHTMLDocument2; s: TStrings; SearchString:
String);
var
ec: IHTMLElementCollection;
e: IHTMLElement;
i: integer;
url: Variant;
begin
ec := doc.links;
for i := 0
to Pred(
ec.length)
do
begin
e :=
ec.item(i, 0)
as IHTMLElement;
url := VarToStr(e.getAttribute(SearchString, 0));
if url <> '
'
then
s.Add(
url);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
docd: IDispatch;
doc: IHTMLDOCUMENT2;
url:
String;
begin
url := EdUrl.Text;
docd := GetDocument(IdHttp1.Get(
url));
end;