title: How to dynamically cut short an mp3 file in php
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1404969/automatically-trimming-a-mp3-in-php">Automatically trimming a mp3 in PHP</a>  </p>
  </blockquote>
  
  
  
  <p>I am currently serving mp3 files via php like the method described in this question: <a href="https://stackoverflow.com/questions/1516661/can-i-serve-mp3-files-with-php">Can I serve MP3 files with PHP?</a> </p>
  
  <pre><code>$track = "sometrack.mp3";
  
  if(file_exists($track)) {
      header("Content-Transfer-Encoding: binary"); 
      header("Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3");
      header('Content-length: ' . filesize($track));
      header('Content-Disposition: filename="sometrack.mp3"');
      header('X-Pad: avoid browser bug');
      header('Cache-Control: no-cache');
      print file_get_contents($track);
  } else {
      echo "no file";
  }
  </code></pre>
  
  <p>How can I server a cut mp3. Like I want to take out the first XX seconds in the file and directly serve it from XX seconds so that the user only gets it from the XX seconds and not from the 00 seconds</p>