首先获取HTML文件要看你使用的前端还是后端
如果是前端可以使用Ajax技术:
$.get('single.html', function(data){JavaScript方法一般不能跨域,这要是浏览器为了安全考虑
如果是使用的后端技术,例如PHP:
$content = file_get_contents("http://www.wenjiangs.com/group/topic-93.html");然后是提取href属性,同样的分为前端和后端
前端:
a_link_arr = $('a').attr('href');后端可以使用正则提取
$match_num = preg_match_all('/<a(.+?)href=[\'"](.+?)[\'"](.+?)>/im', $data, $matche);