I need to run a PHP function every month that checks Tor Exit Nodes, I have the function, but I'm not sure how to run it every month.
Here's the function:
$list = "http://some-tor-list.com/torlist/";
$tor = file_get_contents($list);
I need to run a PHP function every month that checks Tor Exit Nodes, I have the function, but I'm not sure how to run it every month.
Here's the function:
$list = "http://some-tor-list.com/torlist/";
$tor = file_get_contents($list);
You have two options, using a crontab (recommended) or a script that runs constantly (not really recommended).
Using crontab you can run a PHP script the first day of every month using:
0 0 1 * * php /srv/http/tor.php
You can edit your crontab using crontab -e
or you could use the sleep function like this to run every month in PHP:
do {
$list = "http://some-tor-list.com/torlist/";
$tor = file_get_contents($list);
sleep(60 * 60 * 24 * 30);
} while(true);
You should read up about the syntax of crontab, it's extremely powerful.
What you are looking for is called a "cron job". Here is a SO question that answers how to create one:
You can use Cron
to complete these
if in cpanel you'll find this easily
0 0 * * * php /home/site/cron.php
Or if you have a Dedicated server you can open cron tab
Look Here For the more crontab options
You need to create a php script with the content:
$list = "http://some-tor-list.com/torlist/";
$tor = file_get_contents($list);
And then use a cron job to run it every month.