collab / module-scraper
phpscraper 库的简单包装,提供抓取网页的 Magento 服务。
1.0.1
2024-05-12 11:32 UTC
Requires
- magento/framework: *
- spekulatius/phpscraper: *
README
Collab_Scraper 模块是 PHPScraper 的简单包装,它提供从网站抓取数据的服务。
PHPScraper 是一个多功能的 PHP 网络实用工具。其主要目标是简化从网站提取信息的过程,让您能够专注于完成任务,而无需陷入选择器、数据结构准备和转换的复杂性。
基本用法
use Collab\Scraper\Service\ScraperService; ... public function __construct( ScraperService $scraperService ) { $this->scraperService = $scraperService; } ... public function getScrapedData(): ?string { $url = 'https://www.example.com'; $data = $this->scraperService->go($url); echo $data->title; // Title of the page return $data; }
PHPScraper 的完整文档可以在 这里 找到。
安装详情
composer require collab/module-scraper bin/magento setup:upgrade