paumel / scrapper
从URL获取信息的包
v0.0.4
2020-04-28 18:12 UTC
Requires
- php: ^7.1
- guzzlehttp/guzzle: ^6.3 || ^7.0
- guzzlehttp/psr7: ^1.4
This package is auto-updated.
Last update: 2024-09-09 01:10:02 UTC
README
如果您想从网站中提取一些HTML或JSON信息,请使用此包
目录
安装
将包安装到您的Laravel项目根目录
composer require paumel/scrapper
用法
导入scraper类
use Paumel\Scrapper\Scrapper;
如果您想抓取HTML数据
$scrapper = new Scrapper('http://test.com', 'html'); $data = $scrapper->find('a.test-class');
如果您想抓取JSON数据
$scrapper = new Scrapper('http://test.com', 'json'); $data = $scrapper->find('json_parameter');