<?php
// The URL of the RSS feed
$url = 'https://www.aripaev.ee/rss';
// Use file_get_contents() to fetch the feed
$rss = file_get_contents($url);
// Use simplexml_load_string() to parse the XML content
$xml = simplexml_load_string($rss);
// Check if the parsing was successful
if ($xml === false) {
echo "Error parsing the XML\n";
foreach(libxml_get_errors() as $error) {
echo "\t", $error->message;
}
} else {
// Loop through each <item> tag within the <channel> tag
foreach ($xml->channel->item as $item) {
// Access data for each news item
$title = $item->title;
$link = $item->link;
$description = $item->description;
$pubDate = $item->pubDate;
// Output the data to the browser (as an example)
echo "Title: " . $title . "<br>";
echo "Link: " . $link . "<br>";
echo "Description: " . $description . "<br>";
echo "Publication Date: " . $pubDate . "<br><br>";
}
}
?>