gavinggordon/sorcerer
Composer 安装命令:
composer require gavinggordon/sorcerer
包简介
An easy-to-use PHP class for scraping webpages' source code.
关键字:
README 文档
README
Description
An easy-to-use PHP class for scraping webpages' source code.
Usage
Installation
$ composer require gavinggordon/sorcerer
Examples
Insantiation
include( 'vendor/autoload.php' ); use GGG\Http\Data\Collection\Sorcerer as Sorcerer; $scraper = new Sorcerer();
Configuration
$url = 'http://www.testurl.com/index.php'; $regexes = [ '/\<a\s?[^\>]+?\>(.+)\<\/a\>/i', '/\<img\s?([^\>]+?)[\s\/]*?\>/i' ]; $savefile = __DIR__ . './testurl-scrapedata.txt'; $scraper->configure( $url, $regexes, $savefile );
Run
If no filepath was set for "$savefile",...
$data = $scraper->scrape(); print_r( $data );
...the scraped data will be returned.
If a filepath was set for "$savefile",...
$scraper->scrape();
...the scraped data will be saved to the file which you specified.
Issues
If you have any issues at all, please post your findings in the issues page at https://github.com/gavinggordon/sorcerer/issues.
License
This package utilizes the MIT License.
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-14