-1

PHP Simple HTML DOM Parser

Fatal error: Call to a member function find() on boolean in /home/admin/web//public_html/index.php on line 14

Why does it fail?

include("simple_html_dom.php");

$html = file_get_html('http://en.wikipedia.org/wiki/facebook');

$title = $html->find('h1[id=firstHeading]',0)->innertext; 

echo $title;
Barmar
  • 741,623
  • 53
  • 500
  • 612
xeuy
  • 1
  • 1
  • 1

1 Answers1

0

I am not familiar with file_get_html but it probably returns false on errors, so you should check the returned value:

if ($html === false) {
   // check what the error is (look for file_get_html documentation to understand how to get more info on the error
} else {
   // file is ok, process it
}
Danny Yeshurun
  • 407
  • 6
  • 10