ajbdev/

抓取网站并从不同来源提取各种格式的特定信息(HTML、JSON等)

dev-master 2015-01-26 04:35 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:34:39 UTC


README

使用简单的查询字符串快速轻松地从外部来源抓取数据。

use Scraper\Scraper;
use Scraper\Source\Source;

$scraper = new Scraper();

$source = Source::create('https://news.ycombinator.com');
$source->setFakeIdentity(true);

$result = $scraper->scrape($source, 'td.title a');

foreach ($result as $node) {
    echo $node->nodeValue . PHP_EOL;
}

// IBM to cut 111,800 people from its workforce
// Chess: Who will win in this riveting game of Math.random() vs. Math.random()?
// First U.S. Bitcoin Exchange Set to Open
// ...