财管家 首页
当前位置:主页>delphi7/进销存和数据库> 文章内容

狂散银子拉!如何输入一个主页获得所有与之连接的网页?

发布时间:2011-01-04 | QQ免费站
1楼: 如何输入一个主页获得所有与之连接的网页?
比如 我输入http://www.163.com
然后可以获得所有在他的代码中出现与之相连接的网页的代码?
最好给个实例!
答案可以者送100分!

2楼: 回过一个帖子,找不到了,另外找个帖子,关键是引用mshtml和使用links

http://www.delphibbs.com/delphibbs/dispq.asp?lid=2131332
var
doc:IHTMLDocument2;
all:IHTMLElementCollection;
len,i:integer;
item:OleVariant;
begin
if not webbrowser1.busy then
begin
doc:=webbrowser1.Document as IHTMLDocument2;
all:=doc.Get_Links;
len:=all.length;
for i:=0 to len-1 do
begin
item:=all.item(i,varempty);
Memo1.Lines.Add(item);
end;
end;
end;


不早点给分就有人过来抢了[:D]

3楼: ok
先看一下
暂时封贴

4楼: 还有一个问题 你没有解决
就是在这些连接中有一样的 那样的话只保留一个
最好只保留二级与名 或者顶级域名? 不要很长很长的连接到文章的连接如 管家婆企业管理器在哪

5楼: 兄台,那是字符串处理的内容了,自己改吧

procedure TForm1.Button1Click(Sender: TObject);
var
s : string;
function GetURLAddr(const AURL: string): string;
var
strSource, strDest : string;
nIndex : Integer;
begin
strSource := AURL;
nIndex := Pos('/', strSource); // 第一个 /
strDest := Copy(strSource, 1, nIndex + 1);
Delete(strSource, 1, nIndex + 1);
nIndex := Pos('/', strSource); // 第一个 /
strDest := strDest + Copy(strSource, 0, nIndex);
delete(strSource, nIndex + 1, Length(strSource) - nIndex);
Result := strDest;
end;
begin
s := 'http://www.delphibbs.com/delphibbs/dispq.asp?LID=3217293';
Caption := GetURLAddr(s);
end;

6楼: 老兄 给个QQ吧
我的是QQ 363394882
别忘加我哦 有事情商量哦