链接爬虫(用于下载或开发)

时间:2014-01-29 15:38:35

标签: php file-io web-crawler

我有一个关于网络浏览的问题.. 我需要的是一个webcrawler,它可以保存网站上的所有外部链接并将它们打印到文件(csv)。 我正在自己开发它(使用php),但是想知道是否已经有一些可下载的解决方案(不一定是php解决方案).. 当然我找自己了,但找不到任何东西。所以,如果有人可以帮助我,我会非常感激。

此外,开发它的最佳方法是什么?

1 个答案:

答案 0 :(得分:2)

您可以Simple HTML Dom Parserhttp://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


?>