Wallogit.com
2017 © Pedro Peláez
Simple HTML parser for PHP
Version 1.1.5, (*1)
Supports PHP >=5.6.32 Adaptation for Composer and PSR-0 of: Its a HTML dom parser for PHP, you can either process a URL or HTML string, given function will return a DOM object, which can be used for further processing., (*2)
To get DOM object from a URL, use function file_get_html():, (*3)
$dom = HTMLParser::file_get_html("https://google.com");
To get DOM object from a string, use function str_get_html():, (*4)
$dom = HTMLParser::str_get_html("<html><head></head><body></body></html>");
composer require sachinsinghshekhawat/simple-html-parser-php 1.1.5, (*5)
Run "composer require sachinsinghshekhawat/simple-html-parser-php 1.1.5" in your project and ready to go. You can replace last argument with any of the version available., (*6)
<?php
use sachinsinghshekhawat\SimpleHTMLDomParserPHP\HTMLParser;
require 'vendor/autoload.php'; //change path of your vendor autload file
$dom = HTMLParser::file_get_html("https://google.com");
foreach($dom->find('img') as $element)
echo $element->src . '<br>';
For more documentations: http://simplehtmldom.sourceforge.net/, (*7)