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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.