Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Forked from bossman759/rss.php
Created June 21, 2023 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ilgrim/9a68635b190654e5d109c243942dc812 to your computer and use it in GitHub Desktop.
Save Ilgrim/9a68635b190654e5d109c243942dc812 to your computer and use it in GitHub Desktop.
Parse RSS(XML) in php!
$html = "";
// URL containing rss feed
$url = "http://www.realbeta.net63.net/blog/rss?id=1";
$xml = simplexml_load_file($url);
for($i = 0; $i < 1; $i++){
$title = $xml->channel->item[$i]->title;
$link = $xml->channel->item[$i]->link;
$description = $xml->channel->item[$i]->description;
$pubDate = $xml->channel->item[$i]->pubDate;
$html .= "<a target='_blank' href='$link'><b>$title</b></a>"; // Title of post
$html .= "$description"; // Description
$html .= "<br />$pubDate<br /><br />"; // Date Published
}
echo "$html<br />";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment