From 639e5c879797ed7cc15bbc6e69fef9e76eac8aad Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Wed, 23 Jul 2014 10:50:26 +0400 Subject: [PATCH] support ETag and Last-Modified headers --- habr_twister.php | 5 +++-- rssreader.php | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 rssreader.php diff --git a/habr_twister.php b/habr_twister.php index 04fce8a..1faf32b 100644 --- a/habr_twister.php +++ b/habr_twister.php @@ -4,9 +4,10 @@ mb_internal_encoding('UTF-8'); setlocale(LC_CTYPE, 'en_US.UTF-8'); // Load RSS feed +require_once 'rssreader.php'; $feed_uri = 'http://habrahabr.ru/rss/hubs/new/'; -$rss = simplexml_load_file($feed_uri); -if (!$rss) die('Cannot read rss'); +$rss = getRssFeed($feed_uri); +if (!$rss) die('Cannot read rss or it is up to date'); // Initialise TwisterPost require_once 'twisterpost.php'; diff --git a/rssreader.php b/rssreader.php new file mode 100644 index 0000000..2ccf857 --- /dev/null +++ b/rssreader.php @@ -0,0 +1,53 @@ +