PHP Errore php "Fatal error: Call to a member function find() on boolean"

FAK

Utente Bronze
8 Aprile 2018
46
21
6
46
Ciao, chi riesce a dirmi perché mi esce questo errore? "Fatal error: Call to a member function find() on boolean"

Codice:
<?php
include_once('../../simple_html_dom.php');

$html = file_get_html('https://www.w3schools.com/');

$list=$html->find('div[class="w3-bar w3-theme w3-card-2 w3-wide notranslate"]',0);
$list_array=$list->find('a');

foreach( $list->find('a') as $element ){
    echo $element->plaintext;
    echo "<br>";
}

?>
 
Difficile a dire quale di quelle chiamate a find abbia ritornato un bool invece di un oggetto, probabilmente e' false. Potrebbe essere fallita la richiesta a quell'URL (internamente mi sembra usi file_get_contents), fai attach con un debugger o printa i valori con var_dump.
 
  • Mi piace
Reazioni: Valley e FAK