Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?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>"; } } ?>
Copy Clear