Skip to content

Instantly share code, notes, and snippets.

@kennethlarsen
Created January 21, 2013 08:48
Show Gist options
  • Save kennethlarsen/4584669 to your computer and use it in GitHub Desktop.
Save kennethlarsen/4584669 to your computer and use it in GitHub Desktop.
Get RSS from form input
<?php // Load and parse the XML document
$rss = simplexml_load_file($_POST['xmlurl']);
$title = $rss->channel->title;
?>
<html xml:lang="da" lang="da">
<head>
<meta charset="UTF-8">
<title><?php echo $title; ?></title>
</head>
<body>
<h1><?php echo $title; ?></h1>
<?php
// Here we'll put a loop to include each item's title and description
foreach ($rss->channel->item as $item) {
echo "<h2><a href='" . $item->link . "'>" . $item->title . "</a></h2>";
echo "<p>" . $item->description . "</p>";
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment