PHP code example of seosazi / php-html-parser

1. Go to this page and download the library: Download seosazi/php-html-parser 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/ */

    

seosazi / php-html-parser example snippets


// Assuming you installed from Composer:
use PHPHtmlParser\Crawl\WebPageProcessor;
mp($data->getH1Tag());//get array of H1 tag
var_dump($data->getExternalLinks());//get array of all external link (Url class)
var_dump($data->getImageAlt());//get array of all image address and alt tag of them
var_dump($data->getHeader());//get array of header parameters

$data->getUrlInfo()->getUrl();
// if anchor text exists
$data->getUrlInfo()->getAnchorText();
$data->getUrlInfo()->getFabricUrl();
$data->getUrlInfo()->getHomeAddress();
// if parent exists
$data->getUrlInfo()->getParent();
//get all information in array
$data->getUrlInfo()->getUrlInfoArray();

 "   "seosazi/php-html-parser": "^1.0"
}