I'm going to try to explain this, Hope you can follow.

I have a 'Flash Player' that connects using remote links including 'Remote Config File' which uses XML as the configuration.

Flash Player works on directly, .XML files.

Example: name.xml

Then I tested and created a config.php to include the XML File.

<?php
$var = $_GET['var'];
if(file_exists("config/$var.xml")) {
include("config/$var.xml");
} else {
echo "Sorry, $var not found.";
}
?>

Updated the remote code, to connect to the config.php?var=NAME

Works Successfully.

Now, I'm trying to move away from the XML File and use a MySQL Database to 'Read' the 'NEW config.php?var=NAME' and shows fine from the database.

When connecting, to the 'Flash Player' it does NOT want to read it and I'm wondering if it has something to do with the way XML is being outputted, but I've attempted almost everything.

This is for a Live Flash Streaming Player (Live Radio Stations)

Example: Database Driven XML

<?php

include("db.php");

$connect = mysql_connect($db["hostname"], $db["username"], $db["password"]) or die ("Could not connect to MySQL");
mysql_select_db ($db["database"]) or die ("Could not select database");

$radio = $_GET['radio'];

$config["query"]  = "SELECT * FROM config WHERE name='$radio'";
$config["result"] = mysql_query ($config["query"]) or die ("Config Query Failed");
$config = mysql_fetch_object($config["result"]);

$stream["query"]  = "SELECT config.gid, stream.gid, stream.host, stream.port, stream.name, stream.genre FROM config, stream WHERE stream.gid = config.gid";
$stream["result"] = mysql_query ($stream["query"]) or die ("Stream Query Failed");

header('Content-Type: text/xml');

?>

<config>
	<!-- true / false -->
	<auto_start><?php echo $config->auto_start; ?></auto_start>

<player_skin><?php echo $config->player_skin; ?></player_skin>

<main_title><?php echo $config->main_title; ?></main_title>
<playlist_title>PLAYLIST</playlist_title>
<time_text>TOTAL TIME</time_text>
<pan_labels>L,R</pan_labels>

<!-- possible options: GENRE, IP (show in second column in playlist) -->
<playlist_show>GENRE</playlist_show>
<genre_title>Genre</genre_title>
<station_title>Station</station_title>
<quality_title>Quality</quality_title>

<!-- for example: best quality = *****, worst quality = * -->
<quality_icon>*</quality_icon>

<!-- must be an integer 1 - 20 -->
<scroller_speed><?php echo $config->scroller_speed; ?></scroller_speed>

<!-- possible options: #CURRENT_SONG#, #STATION_URL#, #STATION_NAME#, #GENRE#, #CURRENT_ARTIST# -->
<scroller_marquee_content><?php echo $config->scroller_marquee_content; ?></scroller_marquee_content>

<!--Shuffle button enabled-->
<!-- true / false -->
<shuffle_is_enabled><?php echo $config->shuffle_is_enabled; ?></shuffle_is_enabled>

<!-- must be an integer 0 .. 100 -->
<default_volume><?php echo $config->default_volume; ?></default_volume>

<!-- must be an integer -100 .. 100 -->
<default_pan>0</default_pan>

<!-- Message, if player couldn't load music-->
<music_error_message><?php echo $config->music_error_message; ?></music_error_message>

<!-- Timeout to get radio station quality -->
<quality_timeout><?php echo $config->quality_timeout; ?></quality_timeout>

<!-- Timeout to get music name -->
<musicname_timeout><?php echo $config->musicname_timeout; ?></musicname_timeout>

    <?php
    while ($streams = mysql_fetch_array($stream["result"])) {
print "<station url=\"".$streams["host"].":".$streams["port"]."\">
	<name>".$streams["name"]."</name>
	<genre>".$streams["genre"]."</genre>
</station>";
    }
    ?>
</config>

Live Example: http://universalstorm.com/RADIO_FLASH/config.php?radio=UniversalStorm

Remote Working Example: http://www.djdog2006.com/stream.html

Remote Non Working Example: http://www.djdog2006.com/stream.php

Maybe someone can help me out.

    I would to make a note, since I can not edit the post above me.

    The differences bewtween stream.html and stream.php is one has the 'GET' command.

    stream.html

    <script type="text/javascript" src="http://universalstorm.com/RADIO_FLASH/swfobject.js"></script>
    <body bgcolor="#000000">
    	<div id="flashcontent">
    	</div>
    	<script type="text/javascript">
    		var browser=navigator.appName;
    		var res = "";
    		browser = browser.toLowerCase();
    		if(browser=="netscape")
    		{
    			res = "opened_by=MOZILLA";		
    		}
    		else
    		{
    			res = "opened_by=IE";
    		}
    
    	var webradio = new SWFObject("http://universalstorm.com/RADIO_FLASH/webradio.swf?"+res+"&xml=http://universalstorm.com/RADIO_FLASH/config.php?radio=&player_skin=http://universalstorm.com/RADIO_FLASH/skins/skin1.swf", "skin1", "361", "272", "8", "#FFFFFF", true);
    
    	webradio.addParam("quality", "high");
    	webradio.addParam("allowScriptAccess", "always");
    
    	webradio.write("flashcontent");
    </script>
    

    stream.php

    <?php
    $radio = $_GET['radio'];
    ?>
    <script type="text/javascript" src="http://universalstorm.com/RADIO_FLASH/swfobject.js"></script>
    <body bgcolor="#000000">
    	<div id="flashcontent">
    	</div>
    	<script type="text/javascript">
    		var browser=navigator.appName;
    		var res = "";
    		browser = browser.toLowerCase();
    		if(browser=="netscape")
    		{
    			res = "opened_by=MOZILLA";		
    		}
    		else
    		{
    			res = "opened_by=IE";
    		}
    
    	var webradio = new SWFObject("http://universalstorm.com/RADIO_FLASH/webradio.swf?"+res+"&xml=http://universalstorm.com/RADIO_FLASH/config.php?radio=<?php echo $radio; ?>&player_skin=http://universalstorm.com/RADIO_FLASH/skins/skin1.swf", "skin1", "361", "272", "8", "#FFFFFF", true);
    
    	webradio.addParam("quality", "high");
    	webradio.addParam("allowScriptAccess", "always");
    
    	webradio.write("flashcontent");
    </script>
    

    Added the 'Old Config.php as config2.php" that reads the XML File. (Code Above as VAR)

    http://www.djdog2006.com/stream2.php?radio=UniversalStorm
    Look in the 'Source' you will notice that config2.php?radio=UniversalStorm is the XML Config.

    and it's linking too;
    http://universalstorm.com/RADIO_FLASH/config/UniversalStorm.xml

    Again I'm trying to get the MySQL Database driven XML to point to the stream.php'Remote Code' using the config.php?radio=NAME.

      I got it working;

      I changed;

      header('Content-Type: text/xml');

      to

      header('Content-Type: text/plain');

      Showed a 'White space' at the top of

      <config>

      and

      </config> didn't have it's own line.

      After the plain text showed that it WORKS!

      Changed the

      header('Content-Type: text/plain');

      to

      header('Content-Type: text/xml');

      Have XML output; and still works...Odd

        Write a Reply...