-5

Possible Duplicate:
schedule an email in php

How can I keep loading a PHP file on my server after every hour?

It will mail me something. Actually it mails me something when I visit it. But I want it to mail me after every hour. So someone should either visit it each hour or I have to use cron job like something.

Any help will be appreciated.

Community
  • 1
  • 1
  • What sort of hosting do you have (shared/vps/dedi) on what OS (Linux/Windows)? If you are on a shared Linux host (the most common for PHP) then you should have a cron system in your control panel. – halfer Dec 15 '12 at 16:01

1 Answers1

1

You should use a cronjob. Start by opening you terminal and run

crontab -e 

You may need to configure your crontab settings (default editor) if this is the first time you are using crontab. Now, in your editor, you have to call your php script like this: (it is set to be called each hour)

0 * * * * /path/to/php /path/to/your/script.php

You can also use an alias of hourly.

@hourly /path/to/php /path/to/your/script.php
rowasc
  • 320
  • 1
  • 3
  • 10