Pour lister les tags V1

<?php
// Dans ce cas il n'y a qu'un package à inclure 
require_once 'MP3/IDv2/Reader.php';
 
// Un petit podcast de la RTBF : 
// http://www.rtbf.be/podcast/
$myMP3File=realpath("./Essentiel de l'info - 1_12_06.mp3");
 
// Il vaut mieux le tester parce que le reader semble assez cool, 
// en effet si le fichier n'existe pas 
// il ne retournera simplement aucun tag
if(!file_exists($myMP3File))  exit('file not found');
 
echo '<h1>ID TAG V1</h1>' ;
require_once("MP3/Id.php");
$id3 = &new MP3_Id();
$id3->read($myMP3File);
 
echo 'Read <b>"one tag"</b> : Comment : ' . $id3->getTag('comment') .'<br />';
 
echo 'Read <b>All tags</b><dl>';
foreach($id3 as $n => $f)
{
    echo '<dt>' . $n . '<dd>' . $id3->getTag($n) . "\n";
}
echo '</dl>';
?>

Listons les V2

<?php
require_once 'MP3/IDv2/Reader.php';
 
$myMP3File=realpath("./Essentiel de l'info - 1_12_06.mp3");
if(!file_exists($myMP3File))  exit('file not found');
 
echo '<h1>ID TAG V2</h1>' ;
echo "Read ...\n" ;
$reader = new MP3_IDv2_Reader();
$reader->read($myMP3File);
$tagList = $reader->getTag();
$frames = $tagList->getFrames();
 
echo '<ul>';
foreach($frames as $f)
{
    echo '<li>' . var_export($f->toString(),1) . '</li>' . "\n";
}
echo '</ul>';
echo "...finished";
?>

Et maintenant pour écrire

Je n'ai fait que v1 mais je vais ajouter v2 prochainement

<?php
require_once("MP3/Id.php");
 
$myMP3File=realpath("./Essentiel de l'info - 1_12_06.mp3");
if(!file_exists($myMP3File))  exit('file not found');
$id3 = &new MP3_Id();
 $id3->comment = "MOOSH Sample.";
 $id3->write();
 $id3->read($myMP3File);
 
?>