Skip to content

Instantly share code, notes, and snippets.

@greg-randall
greg-randall / index.php
Last active December 1, 2022 15:42 — forked from vsoch/index.php
Generate RSS feed for files in a directory folder. Put this file in a folder with files, modify the $allowed_ext variable to customize your extensions, and $feedName, and $feedDesc. Then navigate to the folder on the web to see the xml feed.
<?php
header("Content-type: text/xml");
$feed_name = "My Audio Feed";
$feed_description = "Feed for the my audio files in some server folder";
$base_url = strtok('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], '?'); //gets the current page's url. strips off the url's parameters
$allowed_extensions = array('mp4','mp3');
?>
<?php echo '<?xml version="1.0"?>'; //we have to use php to output the "<?" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">