From 888b663520be4c50716e5f38f1817571ea2d2d3b Mon Sep 17 00:00:00 2001 From: serega404 Date: Fri, 20 Aug 2021 00:25:46 +0300 Subject: [PATCH] Bug fix --- src/vodokanal.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vodokanal.php b/src/vodokanal.php index 2ee61f8..fad937f 100644 --- a/src/vodokanal.php +++ b/src/vodokanal.php @@ -17,7 +17,7 @@ if (file_exists("db.json")) { // get DOM from URL $html = file_get_html($config['url']); -$all_elements; +$all_elements = null; $dateNow = date("d.m.Y"); echo "Date now: " . $dateNow . "\n"; @@ -36,6 +36,11 @@ foreach ($html->find('td[bgcolor="#ffffff"]') as $e) { } } +if ($all_elements == null) { + echo "Posts not dound"; + exit; +} + echo "The number of posts for this day: " . count($all_elements) . "\n"; if ($db != null) {