PDA

View Full Version : Play mp3 file using php



Moh
13-06-2008, 02:40 PM
Whats the easiest way to have a php file which loads a mp3 file so you don't have to display the url?

e.i:

songname - artist.mp3

would look like:

mp3.php?id=1

Thanks in advance.

Agnostic Bear
13-06-2008, 02:42 PM
header("Content-Type: Audio/MP3");
$lol = file_get_contents("mp3file");
echo($lol);

not sure what the actual mime type for an mp3 file is though

Florx
13-06-2008, 02:48 PM
MP3 — Mime Type: audio/mpeg

According to http://linuxreviews.org/dictionary/MP3/

audio/x-mpeg-3


audio/mpeg3

Moh
13-06-2008, 03:01 PM
MP3 — Mime Type: audio/mpeg

According to http://linuxreviews.org/dictionary/MP3/

audio/x-mpeg-3


audio/mpeg3

I tried that first, but it only plays the first 3 seconds :S

Blob
13-06-2008, 03:45 PM
Ahh, this is a good idea, because if you make a php file that reads out a music file, and if your at school where accessing MP3's are blocked, go to the PHP file and it wont be blocked :)

Agnostic Bear
13-06-2008, 04:24 PM
I tried that first, but it only plays the first 3 seconds :S

doesn't support buffering

Want to hide these adverts? Register an account for free!