Running scripts without web page request?
Moderator: General Moderators
Running scripts without web page request?
OK... I'm not sure if this is possible or not, but here goes...
I'm building a mailing list system for a local movie theatre chain. They want to send showtimes to their subscribers every week.
They'll probably want to revise the e-mails before they go out, so maybe I won't even need this question answered, but I'm still curious.
Is there any way to run a PHP script, and have it triggered by the date/time? NOT by a web page request? For example, the movie showtimes e-mail could be automatically generated and sent at say 3:00am every Monday. Can that be done? I imagine it would take more than just PHP to do that.
If anyone knows, let me know what you think.
I'm building a mailing list system for a local movie theatre chain. They want to send showtimes to their subscribers every week.
They'll probably want to revise the e-mails before they go out, so maybe I won't even need this question answered, but I'm still curious.
Is there any way to run a PHP script, and have it triggered by the date/time? NOT by a web page request? For example, the movie showtimes e-mail could be automatically generated and sent at say 3:00am every Monday. Can that be done? I imagine it would take more than just PHP to do that.
If anyone knows, let me know what you think.
All you need is something to invoke php at regular times/intervals.. Most *nix environments use crontab for that. Under windows you'd probably use the task scheduler... If i'm not mistaken there is a win32 port of crontab for windows now too... Just search this forum (or the web) for cron(tab) and you'll find a lot of good links 
most webhosts provide a front end for managing your account (like cPanel)
look for an icon or a link to CRON/CRONTAB in their controlpanel
look for an icon or a link to CRON/CRONTAB in their controlpanel
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
just try ermm...
although I have no clue what that function would be, sorry 
Code: Select all
if(exec('some crontab function')){ echo "yes Cron!"; } ELSE { "no cron.. poopsticks =["; }Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
lololol wow, that's the *best* code i've ever seen! =Pscrotaye wrote:just try ermm...
although I have no clue what that function would be, sorryCode: Select all
if(exec('some crontab function')){ echo "yes Cron!"; } ELSE { "no cron.. poopsticks =["; }
If you have shell, just type:
to get to your crontab file, use google to find the right syntax to use in this file.
Code: Select all
# crontab -e