Link to home
Start Free TrialLog in
Avatar of Shopies
Shopies

asked on

XML file expiration

Hi experts,
I'm using a flash component which reads its data from a .xml file and this file is updated everytime a use refreshes the website by a .php file so the data is cached in the .xml file. The problem is that this xml file is saved in the temporary files and the flash component keeps reading the data from it which most of the time is old data.

How can I get red of the xml file so it is regenerated everytime a user visits my website?

Best regards,
Avatar of TheDauntless
TheDauntless
Flag of Belgium image

In stead of using an actual .xml file, use a .php (or other serverside language) file that prints out the xml data. You can then add a no-cache header (see snippet);

If you have access to the url of the file to load through actionscript, you can add Math.random() to the file name: "myFile.xml" becomes "myFile.xml?q=" + Math.random();
<?
//geen cache
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?> 

Open in new window

Avatar of Shopies
Shopies

ASKER

I tried your code but it didn't work with me. I placed this code in the .php file.!!
I will try the other way and let you know if it fixed the problem.
 
Regards,
Avatar of Shopies

ASKER

Also tried to place "myFile.xml?q=" + Math.random(); in the .as file but it didn't work too.
 
 
It would really help if you would specify the component you are using.

The php file should have the php snippet at the top and the rest of your xml code below that. (You could optionally also set an xml header)
ASKER CERTIFIED SOLUTION
Avatar of nathanbaker
nathanbaker

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial