我有一个关于网络浏览的问题.. 我需要的是一个webcrawler,它可以保存网站上的所有外部链接并将它们打印到文件(csv)。 我正在自己开发它(使用php),但是想知道是否已经有一些可下载的解决方案(不一定是php解决方案).. 当然我找自己了,但找不到任何东西。所以,如果有人可以帮助我,我会非常感激。
此外,开发它的最佳方法是什么?
答案 0 :(得分:2)
您可以Simple HTML Dom Parser
(http://simplehtmldom.sourceforge.net/)
例如
<?php
include 'simple_html_dom.php';
$html = file_get_html('http://google.com/');
foreach($html->find('a') as $element) {
$link[]=$element->href;
}
//Write into your CSV file
?>