Menu

#158 Fatal error: Call to undefined function file_get_html()

wont-fix
None
2018-12-06
2016-09-07
naohiro19
No

If the following codes are executed under PHP5.6 environment, it will become an error ungiven a definition.
Composer is used.

<?php
require 'vendor/autoload.php';

// Create DOM from URL or file
$html = file_get_html('http://www.google.com/');

// Find all images
foreach($html->find('img') as $element)
    echo $element->src . '<br>';

// Find all links
foreach($html->find('a') as $element)
    echo $element->href . '<br>';

Discussion

  • json born

    json born - 2017-11-16

    have you tried including simple-html-dom.php like this
    require_once('simple_html_dom.php');

     
    👍
    1
  • LogMANOriginal

    LogMANOriginal - 2018-12-04

    This project doesn't support Composer, so the autoloader feature doesn't work. @json-born is right, you should require the parser in order to use it in your project. Alternatively you can add the parser manually to your autoloader script: https://getcomposer.org/doc/01-basic-usage.md#autoloading

     
  • LogMANOriginal

    LogMANOriginal - 2018-12-04
    • status: open --> wont-fix
    • assigned_to: LogMANOriginal
     

Log in to post a comment.

Auth0 Logo