PHP code example of zvook / php5-simple-html

1. Go to this page and download the library: Download zvook/php5-simple-html 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/ */

    

zvook / php5-simple-html example snippets


use SimpleHtml\Dom;

$dom = Dom::str_get_html('<html></html>');
$dom = Dom::file_get_html('http://www.google.com/');

$div = $dom->getElementById('id1');
foreach ($div->getElementByTagName('table.table-class')->find('tr') as $row) {
    $firstCell = $row->find('td', 0);
    $thirdCell = $row->find('td', 2);
    $content = $thirdCell->plaintext;
}