XML Header configuration

Permabanned
Joined
3 Jul 2008
Posts
3,762
Location
My fabulous ship
Hey guys I need some help (Again)

Im making a dynamic audio player for a web site

a logged in user selects a track to add to their playlist
a button activates the playlist and a popup player is called

the player reffers to an XML document for its playlist everytime its called. But if the user was to choose another playlist, the previous playlist chosen still loads due to the xml file being in the users cache.

Does anyone know what I need to enter to disable caching of the xml file? The XML file is created by php dom and I cant find anything on caching..... any advice?
 
Not sure because I need the header to be saved in the XML file and not the php file... here is some of the code:


PHP:
<?php

//I was hoping this would work but it applies to the PHP file
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");


$script = ' 
<script type="text/javascript"> 

javascript:popup("http://www.gbob.com/gbobradio.html","wname")

</script>'; 

$query1 = ("select * from user_playlist_tracks where playlist_id like '$selectedplaylistid' order by date desc");
$result1 = mysql_query($query1) or die ("couldnt get track list!");


// create doctype
$dom = new DOMDocument("1.0");
	
// create root element
$root = $dom->createElement("playlist");
$dom->appendChild($root);
$dom->formatOutput=true;
	
	// create child element
	$trackList = $dom->createElement("trackList");
	$root->appendChild($trackList);	

while ($r1 = mysql_fetch_array($result1))
	{
	$trackid1 = $r1['track_id'];
	
	$query2 = ("select * from audio_song where id like '$trackid1'");
	$result2 = mysql_query($query2) or die ("couldnt get track details!");
	
	while ($r2 = mysql_fetch_array($result2))
		{
		$title2 = $r2['song_title'];
		$bandid2 = $r2['band_id'];
		$file2 = $r2['track_filename'];
		
		$location2 = "http://gbob.s3.amazonaws.com/".$file2;
		
		$query3 = ("select * from band where id like '$bandid2'");
		$result3 = mysql_query($query3) or die ("couldnt get artist info!");
		
		while ($r3 = mysql_fetch_array($result3))
			{
			$creator3 = $r3['band_name'];

				// create child element
				$track = $dom->createElement("track");
				$trackList->appendChild($track);
				
				// create child element
				$creator = $dom->createElement("creator");
				$track->appendChild($creator);
					// create text node
					$text = $dom->createTextNode("$creator3");
					$creator->appendChild($text);
				
				// create child element
				$title = $dom->createElement("title");
				$track->appendChild($title);
					// create text node
					$text = $dom->createTextNode("$title2");
					$title->appendChild($text);
				
				// create child element
				$location = $dom->createElement("location");
				$track->appendChild($location);
					// create text node
					$text = $dom->createTextNode("$location2");
					$location->appendChild($text);

			}
		}
	}
	
// save tree to file
$dom->save("playlist.xml");
	
// save tree to string
$order = $dom->save("playlist.xml");

print $script;

$data['pagenum'] = $pagenum;
$data['page'] = "playlists";
$this->load->view('user/playlists', $data);		

?>

not quite sure how to impliment
PHP:
//I was hoping this would work but it applies to the PHP file
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");

for the XML file....
 
I cant because the flash audio player requires it as an xml file with just xml content.

I only need to find out how to output a xml header from php :/
 
Code:
header("Content-Type: text/xml");
echo '<?xml version="1.0" ?>';
//etc

but it outputs the head data in the php file and not the xml file? I tried that and it didnt output it with the xml file. and even then it still doesnt output the expiry for the cache.

In the end I put it all in its own folder and just put a htaccess file to disable cache :p works fine but I'd have rather known how to get expiry from php dom :p now I feel more noob than before.
 
but the flash file is looking for an xml file on the server, it needs a target to look up once the xml has finished being written, it needs to be saved to file so the static flash player can read the xml file.
 
Back
Top Bottom