View Single Post
Old 07-10-2007, 09:54 PM  
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Start your own radio station with commercials. ( ez tutorial )

Make a folder on your domain , lets call it "radio"

so path should look like www.yoursite.com/radio/

now inside that folder make 2 folders . one called "mp3" and another called "ads"
example
www.yoursite.com/radio/mp3/
www.yoursite.com/radio/ads/

place your songs in folder mp3 and ads in folder ads

save the following as index.php and place it in the "radio" folder

example
www.yoursite.com/radio/index.php

Code:
<?php
set_time_limit(0);
header("ICY 200 OK");
header("icy-notice1: <BR>This stream requires <a href=http://www.winamp.com/>Winamp</a><BR>");
header("icy-notice2: <BR>YEA! <a href=http://www.winamp.com/>Winamp</a><BR>");
header("icy-name: Radio station title");
header("icy-genre: reggae");
header("icy-url: http://www.yoursite.com");


$songs=array();
$mp3 = opendir("mp3/");
while($song = readdir($mp3)){if($song!=".." and $song!="."){$songs[]=$song;}}
$nextad=0;

while(0 != count($songs)){

if($nextad==3){getad();$nextad=0;}

$value=rand(0, count($songs)-1);
$song=$songs[$value];
foreach($songs as $line){if($line!=$song){$songs2[]=$line;}}
$songs=$songs2;
$songs2="";

$fd=fopen("mp3/".$song, "r");
$nullbytes=fgets($fd, 2048);

while(!feof($fd)){echo(fgets($fd, 8912));}
    fclose($fd);
$nextad++;
}


function getad(){
$mp3 = opendir("ads/");
while($ad = readdir($mp3)){if($ad!=".." and $ad!="."){$ads[]=$ad;}}
$fd=fopen("ads/".$ads[rand(0, count($ads)-1)], "r");
$nullbytes=fgets($fd, 2048);
while(!feof($fd)){
$data=fgets($fd, 1024);
echo($data);
flush();
}
fclose($fd);
}
?>
last step is to save the following as ".htaccess" in the "radio" foler
example
www.yoursite.com/radio/.htaccess

Code:
RewriteEngine on
 RewriteRule ^(.*)\.pls index.php [nc]
your radio station url will now be
example
www.yoursite.com/radio/anything.pls

will play in a variety of music players
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote