Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- $dirPath = "The_Directory_Containing_Songs";
- $extension = "mp3";
- $songs = glob($dirPath.'/*.'.$extension);
- $bitrate = 128;
- $strContext=stream_context_create(
- array(
- 'http'=>array (
- 'method'=>'GET',
- 'header'=>"Accept-language: en\r\n"
- )
- )
- );
- header('Content-type: audio/mpeg');
- header ("Content-Transfer-Encoding: binary");
- header ("Pragma: no-cache");
- header ("icy-br: " . $bitrate);
- while( true ) {
- foreach ($songs as $song) {
- $fpOrigin=fopen($song, 'rb', false, $strContext);
- while(!feof($fpOrigin)) {
- $buffer=fread($fpOrigin, 4096);
- echo $buffer;
- flush();
- }
- fclose($fpOrigin);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment