Extracting data from web page with different extractors like css, xpath, regex..., (*1)
Example
Code:, (*2)
<?php
use WebExtractor\DataExtractor\DataExtractorFactory;
use WebExtractor\DataExtractor\DataExtractorTypes;
use WebExtractor\Client\Client;
$factory = DataExtractorFactory::getFactory();
$extractor = $factory->createDataExtractor(DataExtractorTypes::CSS);
$client = new Client;
$content = $client->get('https://en.wikipedia.org/wiki/2014_Winter_Olympics');
$extractor->setContent($content);
$h1 = $extractor->setSelector('h1')->extract();
For more look tests., (*3)
Installation via Composer
-
Install Composer to your project root:, (*4)
curl -sS https://getcomposer.org/installer | php
-
Add a composer.json
file to your project:, (*5)
{
"require": {
"knyga/webextractor": "1.1.2.*@dev"
}
}
-
Run the Composer installer:, (*6)
php composer.phar install
License
WebExtractor is licensed under the MIT license., (*7)
Oleksandr Knyga oleksandrknyga@gmail.com, (*8)
Sobit Akhmedov sobit.akhmedov@gmail.com, (*9)