PHP code example of tomzx / html-parser
1. Go to this page and download the library: Download tomzx/html-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tomzx / html-parser example snippets
$code = file_get_contents('input.html');
$parser = new Parser();
$statements = $parser->parse($code);
$traverser = new NodeTraverser();
$traverser->addVisitor(new ElementStripper(['head', 'a'])); // A visitor which removes any element of a specific type
$statements = $traverser->traverse($statements);
$printer = new Printer();
$printer->output($statements);