XML file expiration

Shopies used Ask the Experts™
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,
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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


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.


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)
There is a extension called CacheManager in flash, this uncaches the data onload. You can find more detail and the extension here:


That has worked great for me in the past.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial