vladlen/html-parser

Serpstat test task. Recursively gets images links from a domain. Saves internal and external links.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/vladlen/html-parser

dev-master 2020-04-24 17:59 UTC

This package is auto-updated.

Last update: 2025-12-25 06:53:17 UTC


README

Serpstat test task. Recursively gets images links from a domain. Saves internal and external links.

Installation:

Add to composer.json:
{
    "require": {
        "vladlen/html-parser": "dev-master"
    }
}
Or execute composer command:

composer require vladlen/html-parser

Usage:

namespace Test\Parser;
require_once (__DIR__."/vendor/autoload.php");

require ('htmlParser.php');
require ('filters.php');

$url = "https://google.com/";
$hrefFilter =  new HrefFilter($url);
$htmlCrawler = new HtmlCrawler();

$aHrefOption = new Option('a', null,    // null for no tag filter
    [new Option('href', $hrefFilter)]);

$parser = new HtmlParser($htmlCrawler, [$aHrefOption]);

$logAction = new UserCallActionParam("Test\\Parser\\_log");
$parser->onLog->add($logAction);

$parser->parse($url);

function _log($val)
{
    ...
}