Jump to content

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


yasdevelopment

Recommended Posts

PHP Fatal error: Call to a member function find() on boolean line 85

 

$search = urlencode($title);                
        $html = file_get_html("http://www.letmewatchthis.pl/?tv=&search_keywords=$search&search_section=2");
        $elements = $html->find(".index_item h2");
        if(!is_null($elements)){

85 is $elements = $html ->find

 

Link to comment
Share on other sites

Google.

 

It's an abandoned, buggy, useless HTML library which, for some strange reason, has gained popularity among newbies. The solution is simple:

  1. Throw away the library and switch to one of the PHP HTML extensions like DOM. You can use XPath to search for elements.
  2. Turn your error reporting all the way up and either log the errors (in production) or display them on the screen (during development).
  3. Read the manual and learn to handle errors. When a function may return false in case of an error, you need to actually cover that case.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.