php - Can I schedule HTTP requests from Apache? -
i trying build website user can control switches. switches on remote nodes (for simplicity nodes can extract useful data http requests). user may set schedule when turn on , turn off switches. (e.g. turn on @ 4:00pm , off @ 6:00pm on tuesdays example).
is possible send http requests wamp/lamp system @ specific times? (no page should loaded in browser)? example, @ 4:00pm on tuesday, send http request turn on , @ 6:00pm send request turn off.
if not, best way handle such scenario? c program maybe?
the website written on php running on apache web server. running on wamp on windows or httpd (under fedora linux). data stored on mysql database (that includes schedule)
thank :-)
use cron
, curl
. cron
can run commands @ particular times, , curl
can send http requests. crontab
might this:
# m h dom mon dow command 0 16 * * tue curl http://localhost/turn_on.php 0 18 * * tue curl http://localhost/turn_off.php
see crontab(5)
more information on format , crontab(1)
more information on how change it. (that's man 5 crontab
, man 1 crontab
, respectively.)
Comments
Post a Comment