flappy_warbucks Posted February 19, 2007 Share Posted February 19, 2007 Hi peps, I am trying to write a script that allows for events to be executed at any given time regardless if there is a visitor on the page or not. Basically i am trying to get the website to email me reports at 16:00 everyday, and i cant actually see a way of doing this without having a visitor on the site to create an action that will start that event. I have tried looking online but nothing really points to what i want, so i am asking if anyone knows of any sites that will teach me how to do this. Many thanks /- flappy -\ Link to comment https://forums.phpfreaks.com/topic/39181-time-based-events-in-php/ Share on other sites More sharing options...
JBS103 Posted February 19, 2007 Share Posted February 19, 2007 I would do some searching on CRON jobs. It will run a file for you repeatedly at any given time. There are also other options out there depending on what you are running. Link to comment https://forums.phpfreaks.com/topic/39181-time-based-events-in-php/#findComment-188695 Share on other sites More sharing options...
skali Posted February 19, 2007 Share Posted February 19, 2007 You will need to create your php script and make it do whatever you want to do then add to cron job if you are on linux. Cron job will execute at a time that you will specify. It basically an scheduled task that automatically executes at the specified time. www.linuxhelp.net/guides/cron/ Link to comment https://forums.phpfreaks.com/topic/39181-time-based-events-in-php/#findComment-188698 Share on other sites More sharing options...
flappy_warbucks Posted February 19, 2007 Author Share Posted February 19, 2007 You will need to create your php script and make it do whatever you want to do then add to cron job if you are on linux. Cron job will execute at a time that you will specify. It basically an scheduled task that automatically executes at the specified time. www.linuxhelp.net/guides/cron/ thanks... The server this will be running on is a remote windows server thats hosted by a outside company. Link to comment https://forums.phpfreaks.com/topic/39181-time-based-events-in-php/#findComment-188724 Share on other sites More sharing options...
scarabatwork Posted February 19, 2007 Share Posted February 19, 2007 You can use a scheduled task to run a command line php call. Look up windows scheduling. Link to comment https://forums.phpfreaks.com/topic/39181-time-based-events-in-php/#findComment-188728 Share on other sites More sharing options...
monk.e.boy Posted February 19, 2007 Share Posted February 19, 2007 if you don't have access to cron then you could add some code to your index.php: 1. time > 4:00 2. query DB has a report been sent today? 3. send report. 4. set flag in db that report has been sent. Then if your site is visited regularly the report will be sent. But obviously if no one visits your site : no report sent. Better solution would be to code a simple RSS page and check that everyday (I think Firefox, IE and Outlook all cope with RSS ok). You could hide the RSS page behind an Apache user name and password to provide some security. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/39181-time-based-events-in-php/#findComment-188753 Share on other sites More sharing options...
skali Posted February 19, 2007 Share Posted February 19, 2007 If you do not have access of windows server through VNC etc to schedule tasks, you can ask the hosting company by providing them the path of file and they will be able to help you out by setting up the schedule task for you. Link to comment https://forums.phpfreaks.com/topic/39181-time-based-events-in-php/#findComment-188804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.