Yes, I know the title is confusing enough, but here is what I want to do:
I have created 3 websites (for clients. I have no control over them). All of these sites load a certain page of my main website. (with PHP file_get_contents – lets name it http://www.mainsite/x.php).
The problem here is the bandwidth. I’d like the 10 websites to create some temporary local file with that x.php file, rather then load the http://www.mainsite/x.php file every time. However I may make some changes to that x.php file so the local file should update itself every week or so.
Again what I mean is:
website 1,2 and 3 has a PHP file_get_contents of http://www.mainsite/x.php. On first load it should create a x.html file with the contents of x.php (i.e: http://www.website1/x.html). After a week website 1,2 and 3 should load http://www.mainsite/x.php again and create a new x.html file if changes have been made to the http://www.mainsite/x.php file.
This function will check the file last modification and if its more than 24 hours it will rewrite it.. To start it just run it from a cron task or put it inside your code at some page which is openned each day to be sure that it will be runned..
At $string you have to set file new content and you can do that with file_get_contents() from other file.. OR just generate some string at custom..