refactors / smart-scraper
A smart PHP web scraper.
Installs: 37
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 1
pkg:composer/refactors/smart-scraper
Requires
- php: >=5.6.0
- fabpot/goutte: ^2.0
This package is not auto-updated.
Last update: 2020-08-21 20:18:43 UTC
README
Smart Scraper is a PHP scraper to scrape information from web pages. It can help you doing that horrible task in a very easy and smart way.
Installation
Smart Scrapper needs PHP 5.6.0+ and you can use it via Composer:
composer require refactores/smart-scraper
Usage
Create a Smart Scraper instance:
$scraper = new SmartScraper\Parser($theUrlYouWantToScrape);
Then, if you want to save the text of some selector, you should use:
$scraper->saveText($name, $expression, [$attribute = null]);
The value is saved on $scraper->{$name}. Example:
$scraper->saveText( 'nick', '.header h1' ); echo $scraper->nick;
If you just want to receive the HTML you must use:
$scraper->saveHtml($name, $expression, [$index = 0]);
The $index referes to the position of the element in the page in the case of having more than one.