Copying XML file with PHP

software development


I have an XML file with some sensor data on a local server. I’d like to copy it to a Dreamhost server about every 3 seconds for a live update on a web site. The web site would be displayed on a computer that is always running, so the data would need to be visible 24/7/365.

First, is this possible?

Second, what bandwidth am I talking about here? The XML file has about 20 temperature sensor readings.

Finally, what is the easiest way to do this? PHP?


I have a pretty simple setup that uses http post to send weather data in CSV format about once per second. If bandwidth is a concern you might want to consider using a CSV format as it will consume less. While XML may be the more modern approach it does bloat the size of the data.

Server side there is just a tiny php script that reads the post data and saves it to a .txt file, the data is then read from that file, if someone is viewing the website. Additionally, I have a cron running that detects if the data hasn’t been updated for 60 seconds, if it hasn’t the cron adds a site down message to the website and let’s me know via email.


The data that I’m copying to the Dreamhost server is only a 4k file. If I run this a few times per minute, I don’t think this will add up to much every day.