php获取远程页面上的所有链接
2014-01-08 10:07
288 查看
获取远程页面上的所有链接
$html = file_get_contents('http://www.php100.com'); $dom = new DOMDocument(); @$dom->loadHTML($html); // grab all the on the page $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("/html/body//a"); for ($i = 0; $i < $hrefs->length; $i++) { $href = $hrefs->item($i); $url = $href->getAttribute('href'); echo $url.'<br />'; }
相关文章推荐
- php获取页面所有链接的正则表达式
- PHP代码:获取指定URL页面中的所有链接
- PHP代码:获取指定URL页面中的所有链接
- PHP获取指定URL页面中的所有链接
- PHP 获取指定URl页面中所有链接
- PHP 获取指定URL页面中的所有链接
- 解析PHP中的file_get_contents获取远程页面乱码的问题
- delphi 获取某个页面所有的链接
- 解析PHP中的file_get_contents获取远程页面乱码的问题【转】
- C#获取远程网页中的所有链接URL(网络蜘蛛实现原理)
- C#获取远程网页中的所有链接URL(网络蜘蛛实现原理)
- php获取网页上所有链接的方法
- 获取统计页面所有a链接的点击次数(JS初学者)
- Python获取当前页面内所有链接的四种方法对比分析
- C#获取远程网页中的所有链接URL
- C#获取远程网页中的所有链接URL(网络蜘蛛实现原理)
- PHP正则获取页面所有图片地址
- php获取远程数据,避免页面卡死问…
- 解析PHP中的file_get_contents获取远程页面乱码的问题