首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

请问 idHTTP接收网页源代码有关问题

2012-02-29 
请教 idHTTP接收网页源代码问题Delphi(Pascal) codeprocedure TForm1.Button14Click(Sender: TObject)var

请教 idHTTP接收网页源代码问题

Delphi(Pascal) code
procedure TForm1.Button14Click(Sender: TObject);var  machs: IMatchCollection;  Matchs: Match;  submatch: ISubMatches;  i: integer;  url,url1:string;begin  url:='http://www.cnblogs.com/del/archive/2007/12/21/1009482.html';  str :=idhttp1.get(url);  RegExp1.Global := true;  RegExp1.Pattern :='<img src=\"(.+?)\"';  RegExp1.IgnoreCase := true;  machs := RegExp1.Execute(str) as IMatchCollection;  for i := 0 to machs.Count - 1 do  begin  Matchs := machs.Item[i] as Match;  submatch := Matchs.SubMatches as ISubMatches;  memo4.Lines.Add(matchs.Value);  end;end;

URL随便写个网址就能匹配到源代码中的图片地址,但是写本地的HTML文件(file:///D:/6.21/6.21/index.htm)就是不行,提示错误 EIDUnknownProtocol with message '' 是不是地址的问题呀 但那个// 能组合的我几乎换遍了 就是不行 求教啊

[解决办法]
帮顶。
[解决办法]
http协议...
file这是啥协议呢?
本地的话自己架设一个HTTP通过
idhttp1.get('http://127.0.0.1/index.htm');
这样就可以了
[解决办法]
2楼正解。tidhttp是基于HTTP协议的!!你本地的话是不行的!!!
[解决办法]
楼主可以本地架设服务器进行访问 比如说:“http://127.0.0.1/XXXXX.html”

热点排行