sanzodown/simple-php-crawler

用 PHP 编写的简单爬虫。

dev-master 2021-03-24 18:53 UTC

This package is not auto-updated.

Last update: 2024-10-03 11:11:43 UTC


README

这是一个使用 DOMDocument 的简单 PHP 爬虫库,用于教学目的。

安装

composer require sanzodown/simple-php-crawler

使用

$crawler = new Crawler("https://www.domain.com/");

// if u need to be authentificated
$crawler->setLogin("username","password");

方法

//return an array of the DOMNode
$result = $crawler->filter(".header-logo > a");

//some lazy methods
$imgs = $crawler->getAllImages();
$links = $crawler->getAllLinks();