simple_html_dom::load_file PHP Method

load_file() public method

load html from file
public load_file ( )
    function load_file()
    {
        $args = func_get_args();
        $this->load(call_user_func_array('file_get_contents', $args), true);
        // Per the simple_html_dom repositiry this is a planned upgrade to the codebase.
        // Throw an error if we can't properly load the dom.
        if (($error = error_get_last()) !== null) {
            $this->clear();
            return false;
        }
    }

Usage Example

function get_next_page_url($url)
{
    $html = new simple_html_dom();
    $html->load_file($url);
    $next_page = $html->find('.next_page');
    $next_page_link = null;
    foreach ($next_page as $next_page_link) {
        $next_page_link = $next_page_link->href;
    }
    return 'https://www.goodreads.com' . $next_page_link;
}
All Usage Examples Of simple_html_dom::load_file