Here's the deal:
I'm trying to generate a .m3u stream file on the fly and then delete it once the file is no longer in use. Here's the code I have so far which seems to be creating the file and then deleting it immediately, instead of reading it.
ideally when the file is read it starts streaming and when the user closes the file it is then unlinked.
print("<a href=\"test_file.php?stream=yes&down=songname.mp3&songId=25\">stream this file</a>");
if(isset($stream)){
connect();
$sql="SELECT SongLocationStream FROM database.table WHERE fileId=$fileId";
$runQuery=mysql_query($sql);
while($getStream = mysql_fetch_array($runQuery)){
$m3uName=$getStream["storedm3ufilename"];
fopen($m3uName, "w+");
if ($file=fopen("$m3uName", "w+")){
fputs($file, "http://location/songname.mp3");
readfile($m3uName);
unlink($m3uName);
}
}
}
Any help is greatly appreciated