kevin87 Posted January 29, 2014 Share Posted January 29, 2014 Hi Everyone, I have an interesting question that I have had a hard time searching for so I thought I would throw it on here to see if you guys could help. I am currently using the following to load a file to $html using $html = file_get_contents("text.txt"); Is there a way to have this file load at a certain time of the day. For example, it loads the file at 8PM every day? Thanks, Kevin Quote Link to comment https://forums.phpfreaks.com/topic/285754-file_get_contents-at-certain-time/ Share on other sites More sharing options...
requinix Posted January 29, 2014 Share Posted January 29, 2014 Probably, but your question doesn't make sense. Load into what? What is changing and how does that affect what you're doing with $html? It sounds like the problem you're trying to solve may be much simpler than you think it is. Quote Link to comment https://forums.phpfreaks.com/topic/285754-file_get_contents-at-certain-time/#findComment-1466890 Share on other sites More sharing options...
kevin87 Posted January 29, 2014 Author Share Posted January 29, 2014 Yeah sorry it is a little confusing maybe I can ask it a little better. Lets say my text.txt file is changing constantly and I have users visiting my page consistently I only want my $html variable to get the contents from text.txt at 8PM. The reason for this is because the file is changing all the time and I want to get the info exactly at 8PM. Does that make more sense? Quote Link to comment https://forums.phpfreaks.com/topic/285754-file_get_contents-at-certain-time/#findComment-1466894 Share on other sites More sharing options...
kevin87 Posted January 29, 2014 Author Share Posted January 29, 2014 (edited) well now after I wrote all of that I think maybe I should just do a copy of the file on my linux server to a different file at 8PM every day. That would probably be a whole lot easy then doing something crazy with php. Edited January 29, 2014 by kevin87 Quote Link to comment https://forums.phpfreaks.com/topic/285754-file_get_contents-at-certain-time/#findComment-1466895 Share on other sites More sharing options...
Mace Posted January 29, 2014 Share Posted January 29, 2014 Try setting a cronjob. That's a scheduled action on your server. http://en.wikipedia.org/wiki/Cron Quote Link to comment https://forums.phpfreaks.com/topic/285754-file_get_contents-at-certain-time/#findComment-1466910 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.