PHP code example of alc / dom-parser-helper
1. Go to this page and download the library: Download alc/dom-parser-helper 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/ */
alc / dom-parser-helper example snippets
use Alc\HtmlDomParserHelper;
$helper = new HtmlDomParserHelper();
$parser = $helper->parse('http://www.lemonde.fr/');
// Get curl informations (status code, etc..)
print_r( $helper->getResponse()->getInfos() );
// Get page title
var_dump( $helper->getPageTitle() );
// Get page description
var_dump( $helper->getPageDescription() );
// Get favicon url
var_dump( $helper->getPageFavicon() );
// Get canonical url
var_dump( $helper->getPageCanonical() );
// Get all metas info
print_r( $helper->getPageMetas() );
// Get rss feeds
print_r( $helper->getPageFeeds() );
// Get all urls
print_r( $helper->findAllUrls() );
// Get the php-simple-html-dom-parser
$nodes = $parser->find('a');
foreach( $nodes as $node ) {
echo $node->innertext, "\n";
}
// Clean memory
$helper->clear();