PHP code example of ivopetkov / html5-dom-document-php
1. Go to this page and download the library: Download ivopetkov/html5-dom-document-php 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/ */
ivopetkov / html5-dom-document-php example snippets
= new IvoPetkov\HTML5DOMDocument();
$dom->loadHTML('<!DOCTYPE html><html><body>Hello</body></html>');
echo $dom->saveHTML();
$dom = new IvoPetkov\HTML5DOMDocument();
$dom->loadHTML('<!DOCTYPE html><html><body><h1>Hello</h1><div class="content">This is some text</div></body></html>');
echo $dom->querySelector('h1')->innerHTML;
// Hello
echo $dom->querySelector('.content')->outerHTML;
// <div class="content">This is some text</div>