thank you for the code.
This helped me greatly.
However I am now trying to loop through a directory and get the id3 tag of each file in that directory.

Here's my code
Code:
<HTML>
<HEAD>
 <TITLE>MP3 Playlist</TITLE>
</HEAD>
<BODY>
<?php

//Declarations
$dir = "/private/var/root/Media/iTunes_Control/Music/F00";
//$mp3 = "/private/var/root/Media/iTunes_Control/Music/F00/YSDN.mp3"; //MP3 file to be read

                 //make a array of genres
    $genre_arr = array("Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge",
"Hip-Hop","Jazz","Metal","New Age","Oldies","Other","Pop","R&B",
"Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska",
"Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient",
"Trip-Hop","Vocal","Jazz+Funk","Fusion","Trance","Classical",
"Instrumental","Acid","House","Game","Sound Clip","Gospel",
"Noise","AlternRock","Bass","Soul","Punk","Space","Meditative",
"Instrumental Pop","Instrumental Rock","Ethnic","Gothic",
"Darkwave","Techno-Industrial","Electronic","Pop-Folk",
"Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta",
"Top 40","Christian Rap","Pop/Funk","Jungle","Native American",
"Cabaret","New Wave","Psychadelic","Rave","Showtunes","Trailer",
"Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro",
"Musical","Rock & Roll","Hard Rock","Folk","Folk-Rock",
"National Folk","Swing","Fast Fusion","Bebob","Latin","Revival",
"Celtic","Bluegrass","Avantgarde","Gothic Rock","Progressive Rock",
"Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band",
"Chorus","Easy Listening","Acoustic","Humour","Speech","Chanson",
"Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus",
"Porn Groove","Satire","Slow Jam","Club","Tango","Samba",
"Folklore","Ballad","Power Ballad","Rhythmic Soul","Freestyle",
"Duet","Punk Rock","Drum Solo","Acapella","Euro-House","Dance Hall");

//$dir = getcwd() . "\n";

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($fileread = readdir($dh)) !== false) {
            //show the file name and location
            $fullpath = $dir . $fileread;
            echo "filename: <b>$fullpath</b>";
            echo "<br>";

            //Get the ID3 Tag info
            $musicfile = $fullpath; //fopen($fullpath, "r");
            fseek($musicfile, -128, SEEK_END);
            
            $tag = fread($musicfile, 3);
            
            if($tag == "TAG")
            {
            $data["song"] = trim(fread($musicfile, 30));
            $data["artist"] = trim(fread($musicfile, 30));
            $data["album"] = trim(fread($musicfile, 30));
            $data["year"] = trim(fread($musicfile, 4));
            $data["comment"] = trim(fread($musicfile, 30));
            $data["genre"] = $genre_arr[ord(trim(fread($musicfile, 1)))];
            }
            else
                    die("MP3 file does not have any ID3 tag!");

            fclose($musicfile);

            while(list($key, $value) = each($data))
                {
                print("$key: $value<br>\r\n");
                }
        }
    }
}
//echo getcwd() . "\n";
//echo $sCwd = (substr(PHP_OS, 0, 3) == 'WIN') ? strtolower(getcwd()) : getcwd();
?>
</BODY>
</HTML>
when you try to run it you get the following error:
Code:
filename: /private/var/root/Media/iTunes_Control/Music/F00.

Warning: fseek(): supplied argument is not a valid stream resource in /private/var/root/Sites/getid3.php on line 49

Warning: fread(): supplied argument is not a valid stream resource in /private/var/root/Sites/getid3.php on line 51
MP3 file does not have any ID3 tag!
any ideas why?