PHP code example of magento / dom

1. Go to this page and download the library: Download magento/dom 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/ */

    

magento / dom example snippets



l = file_get_contents("name.html");
$document = new \Gt\Dom\HTMLDocument($html);

if(isset($_GET["name"])) {
	$document->querySelector(".name-output")->innerText = $_GET["name"];
}

echo $document->saveHTML();