| 发表于:2008-01-12 04:22:27 楼主 |
如何判断这中 url http://www.baidu.com/baidu.rar 是不是有效 下面这个函数 是我写的 如果参数是 http://www.baidu.com 这个函数有效 但是参数是http://www.baidu.com/baidu.rar的时候这个函数 就没了效果谁能告诉我应该怎么改 function get(url: string): boolean; var idhttp: tidhttp; ss: string; begin result:= false; idhttp:= tidhttp.create(nil); try try idhttp.handleredirects:= true; //必须支持重定向否则可能出错9c ?$m g7z y {0k m o idhttp.readtimeout:= 30000; //超过这个时间则不再访问 ss:= idhttp.get(url); if idhttp.responsecode=200 then result :=true; except end; finally idhttp.free; end; end; function get(url: string): boolean; var idhttp: tidhttp; ss: string; begin result:= false; idhttp:= tidhttp.create(nil); try try idhttp.handleredirects:= true; //必须支持重定向否则可能出错9c ?$m g7z y {0k m o idhttp.readtimeout:= 30000; //超过这个时间则不再访问 ss:= idhttp.get(url); if idhttp.responsecode=200 then result :=true; except end; finally idhttp.free; end; end; 不要 看报的是http 404 ,http 302,这样的 ~再根据错的不同的信息进行处理 这样的是判断网页 就别说了 直接给个思路 |
|
|
|
|