/ Published in: PHP
I found this script out in space and think it's rad. Click on the URL to see this authors profile. The easiest way to use this script is to place it in the same directory as your mp3's then make a request to the php. The php will return an XML with the song Path, Title, and Author which is great for Flash.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $dir = 'directory_of_mp3_files'; $file_type = 'mp3'; $play_list = '<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\'?>'; $play_list .= "<playlist>"; // Open directory, read contents and add to file_list if correct file_type if ($file != '.' && $file != '..') { // if file has .mp3 extension if ($name_array[1] == $file_type) { $play_list .= '<song>'; $file = "$dir/$file"; $play_list .= '<file>' . $file . '</file>'; // if id3 tag is found... if ($tag == "TAG") { // if no id3 tag... } else { $play_list .= '<title>unknown title</title>'; $play_list .= '<artist>unknown artist</artist>'; } // close file $play_list .= '</song>'; } } } // close directory $play_list .= '</playlist>'; // echo the xml file echo "$play_list"; } } ?>
URL: http://www.gotoandlearnforum.com/memberlist.php?mode=viewprofile&u=954