knyga/webextractor

Extracting data from web page with different extractors like css, xpath, regex...

dev-master / 1.1.2.x-dev 2014-11-28 13:47 UTC

This package is not auto-updated.

Last update: 2020-01-10 14:59:31 UTC


README

Extracting data from web page with different extractors like css, xpath, regex...

Example

Code:

<?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.

Installation via Composer

  • Install Composer to your project root:

    curl -sS https://getcomposer.org/installer | php
  • Add a composer.json file to your project:

    {
      "require": {
        "knyga/webextractor": "1.1.2.*@dev"
      }
    }
  • Run the Composer installer:

    php composer.phar install

License

WebExtractor is licensed under the MIT license.

Oleksandr Knyga oleksandrknyga@gmail.com

Sobit Akhmedov sobit.akhmedov@gmail.com