2017 © Pedro Peláez
 

library xget

XPATH-based site parsing library

image

eznio/xget

XPATH-based site parsing library

  • Thursday, October 5, 2017
  • by evgeny-zinder
  • Repository
  • 1 Watchers
  • 0 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Deadly simple XPath-based parser

Usage

Parse element(-s) by single query

$result = (new \eznio\xget\Xget(new \GuzzleHttp\Client()))
    ->setUrl('http://spb.questguild.ru/choose_city')
    ->parse([
        'cities' => '//ul[@class="list-check"]/li/a'
    ]);

$cities = ['Moscow', 'Saint-Petersburg', ... ];

Parse elements with nested subqueries

A bit more difficult case., (*1)

First of all, you set root node to parse using @ array key., (*2)

Then you define elements to be parsed from the root elements using XPath-queries from the root of the parent query result., (*3)

$result = (new \eznio\xget\Xget(new \GuzzleHttp\Client()))
    ->setUrl('http://spb.questguild.ru/choose_city')
    ->parse([
        'cities' => [
            '@' => '//ul[@class="list-check"]/li',
            'city' => '//a',
            'url' => '//a/@href'
        ]
    ]);

$cities = [
    [
        'name' => 'Moscow',
        'url' => 'http://moscow.questguild.ru',
    ],
    [
        'name' => 'Saint-Petersburg',
        'url' => 'http://spb.questguild.ru',
    ],
    . . .
];

The Versions

05/10 2017

dev-master

9999999-dev https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath

05/10 2017

v1.0.5

1.0.5.0 https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath

05/10 2017

v1.1

1.1.0.0 https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath

01/03 2017

v1.0.4.1

1.0.4.1 https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath

01/03 2017

1.0.4

1.0.4.0 https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath

01/03 2017

1.0.3

1.0.3.0 https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath

01/03 2017

1.0.2

1.0.2.0 https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath

01/03 2017

1.0.1

1.0.1.0 https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath

28/02 2017

1.0

1.0.0.0 https://github.com/eznio/xget

XPATH-based site parsing library

  Sources   Download

MIT

The Requires

 

The Development Requires

parser xpath