Forum Moderators: coopster

Message Too Old, No Replies

PHP & Dynamic ASX

Script PHP to create dynamic ASX

         

kikiat

11:35 am on Jun 21, 2007 (gmt 0)

10+ Year Member



Hello,

I needed to dynamically create ASX files to be played with an embedded Windows Media Player.

After along search I finally found the following script:

*****AsxPlay.php**************

<?php

header("Cache-control: public");
header("Content-Disposition: filename=playlist.asx");
header("Content-Type: video/x-ms-asf;");

$channel= $_GET["channel"];

function GetStream
{
your function that will get the stream in a database or by tweaking an other page or file on the web :)
}

echo "<ASX version = \"3.0\">\n";
echo "<TITLE>". $channel . "</TITLE>";

echo "<ENTRY>\n";
echo "<REF HREF = \"". GetStream . "\" />\n";
echo "</ENTRY>\n";

echo "</ASX>\n";

?>

*****************************

the php is called by a simple link for example:

<a href="AsxPlay.php?channel=rockstation"> Rock it! </a>

Some websites periodically update their streams' names in order to get rid of leechers.
But with this PHP script you may give them a tough time to get rid of you ;-p

kikiat

10:22 am on Jun 24, 2007 (gmt 0)

10+ Year Member



The script above can be applied to dynamic PLS files.
Just need to change the header as follows:

header("Cache-control: public");
header("Content-Disposition: filename=playlist.pls");
header("Content-Type: audio/scpls;");

:-)