Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 141 | All time: 9,196 This week: 524 |
Version | License | PHP version | Categories | |||
sorcerer 1.0.0 | MIT/X Consortium ... | 5 | PHP 5, Web services |
Description | Author | |
This class can scrape Web page content using regular expressions, |
An easy-to-use PHP class for scraping webpages' source code.
$ composer require gavinggordon/sorcerer
include( 'vendor/autoload.php' );
use GGG\Http\Data\Collection\Sorcerer as Sorcerer;
$scraper = new Sorcerer();
$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 );
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.
If you have any issues at all, please post your findings in the issues page at https://github.com/gavinggordon/sorcerer/issues.
This package utilizes the MIT License.
Files (6) |
File | Role | Description | ||
---|---|---|---|---|
src (1 directory) | ||||
.travis.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE.txt | Doc. | Documentation | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.