Skip to content

tuxonice/php-simple-html-dom-parser

 
 

Repository files navigation

php-simple-html-dom-parser

This package is a fork of sunra/php-simple-html-dom-parser with improvements and fixes. The original work was created by:

This fork is distributed under the MIT License, same as the original project.

Install

composer require tuxonice/php-simple-html-dom-parser:^2.0

Usage

use Tlab\HtmlDomParser\HtmlDomParser;

// Parse from a string
$dom = HtmlDomParser::str_get_html($str);
// or parse from a file
$dom = HtmlDomParser::file_get_html($file_name);

// Find elements using CSS selectors
$elems = $dom->find($elem_name);

// Example: Find all links
$links = $dom->find('a');
foreach($links as $link) {
    echo $link->href . "\n";
}

About

PHP Simple HTML DOM Parser adaptation for Composer and PSR-0

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 98.1%
  • Makefile 1.4%
  • Other 0.5%