D
D
Denis Demin2018-09-05 23:51:18
PHP
Denis Demin, 2018-09-05 23:51:18

How to get rid of an error in a line?

PHP Fatal error: Call to a member function find() on boolean in on line 24
Here is the line:
$date = $content_dom->find('.date', 0);
Here is the whole code of a simple parser:

<meta charset="utf-8">
<?php
  /*
    Парсер фильмов
  */

  include_once('lib/SQL.php');
  include_once('lib/curl_query.php');
  include_once('lib/simple_html_dom.php');

/*	$sql = SQL::Instance();*/
  
  $html = curl_get('http://САЙТ');
  $dom = str_get_html($html);
  
  $courses = $dom->find('.content-container');
  
  foreach($courses as $course) {
    $a = $course->find('a', 0);
    
    $content = curl_get('http://САЙТ' . $a->href);
    $content_dom = str_get_html($content);
    
    $date = $content_dom->find('.date', 0);
    echo $a->plaintext . ' ' . $date->plaintext;
    
    break;
      
      
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question