-1

So as the title says, I'd like to trigger a PHP Function(Particularly a cURL Function) at a particular time, eg. 10AM EST 18/08/2021. How could I go about doing this, I've found very little to no documentation on this anywhere.

I could also add that if a Discord Bot is required(As the cURL Function goes to Discord) I could always do that as well, but just a few pointers would be appreciated!

1 Answers1

1

Use cron.

On a Linux server, login and do crontab -e.

This is from the documentation that came with my crontab:

# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').

# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/

So, in your case, you would do:

0 10 18 08 * php script.php
iateadonut
  • 1,951
  • 21
  • 32