PHP code example of royalmar / simple-html-dom-parser

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

    

royalmar / simple-html-dom-parser example snippets


$parser = new \HtmlDomParser();
// get html dom from file
$html = $parser->fileGetHtml('http://www.google.com');
// get html dom from string
$html = $parser->strGetHtml('<p>Hello World</p>');

//OR

// get html dom from file
$html = \HtmlDomParser::fileGetHtml('http://www.google.com');
// get html dom from string
$html = \HtmlDomParser::strGetHtml('<p>Hello World</p>');

'providers' => array(
    ...
    'Royalmar\HtmlDomParser\HtmlDomParserServiceProvider',

    //Laravel 5.1+
    Royalmar\HtmlDomParser\HtmlDomParserServiceProvider::class,
    ...

'aliases' => array( 
    ...
    'HtmlDomParser' => 'Royalmar\HtmlDomParser\HtmlDomParser',

    //Laravel 5.1+
    'HtmlDomParser' => Royalmar\HtmlDomParser\HtmlDomParser::class,
    ...