gavinggordon / sorcerer
An easy-to-use PHP class for scraping webpages' source code.
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/gavinggordon/sorcerer
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2025-09-28 06:18:13 UTC
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.