PHP Fatal error: calling a member function of find () for a non-object, however my function works

I get this error on line 71 of my code, however the function of this line is working correctly, and it does what I expect from it.

However, I noticed that my error log is filled with these lines:

[09-Dec-2013 14:54:02 UTC] PHP Fatal error: call of find () member function for non-object in / home / sportve / public _html / open_event_common.php on line 71

What I checked for:

simple_html_dom_parser is already on, and this function, which line 71 should perform, is working.

Here is line 71 of my code:

$content->find('a.openevent', 0)->innertext = '';

so what is confusing what causes this error in my error log file?

Edit: here is the full code:

<?php       
    $url = "static/" . $cat_map[$cat]['url'];
    $html = file_get_html($url);
    $content = $html->find('div#event-pane > div#e' . $event_id, 0);
    $content->find('a.openevent', 0)->innertext = '';
    $content->find('h3.lshtitle', 0)->onclick = '';
    $content->find('h3.lshtitle', 0)->tag = 'div';
    $content->find('div.lshtitle', 0)->class = 'ttl';                
?>
+4
source share
1

, , , $html $content .

9 10, " - [ ] -" , , . . :

$url = "static/" . $cat_map[$cat]['url'];
if (!empty($url)) {
  $html = file_get_html($url);
  if (!empty($html)) {
    $content = $html->find('div#event-pane > div#e' . $event_id, 0);
    if (!empty($content)) {
      $content->find('a.openevent', 0)->innertext = '';
      $content->find('h3.lshtitle', 0)->onclick = '';
      $content->find('h3.lshtitle', 0)->tag = 'div';
      $content->find('div.lshtitle', 0)->class = 'ttl';
    }
  }
}

, , , $url .

+14

All Articles