Forum Moderators: coopster

Message Too Old, No Replies

Automated PHP Emailer

Email Webstats every morning automatically

         

wfernley

5:25 pm on Aug 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

I was curious if this is possible. I need to make a script for our website that emails me everyday on certain statistics regarding our website. I was curious if there is a way that I can create this script to automatically email me every morning with the previous days statistics. I thought I remember seeing something similar to Linux's Crontab except it was a PHP version.

Has anyone had any experience with created an automated PHP emailer?

Thanks in advance for your help :)

Wes

jatar_k

5:44 pm on Aug 17, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



why not fire off the script with cron? I have tons of these, I just run a nightly cron and have it send me whatever I need.

wfernley

5:52 pm on Aug 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I heard you can't use cron, or that you can its just extremely difficult. Would you happen to have some examples or howto's?

jatar_k

7:05 pm on Aug 17, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



all the cron does is start the script at a given time, the script itself is just a regular old php script.

I have a cron line like so

31 9 * * 1,2,3,4,5 /usr/local/bin/php /example/crons/get_conversion_rate.php &

that runs at 931am monday to friday

the script itself just pulls rates from a bank, updates a db, logs some values and emails me the new rates. I can't post it though sorry, it would take hours to get all of the specifics out. It just uses a regular old mail() call to send the email.

wfernley

7:18 pm on Aug 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Jatar_k. I didn't think it was that easy. I currently have cron setup to update my AwStats everyday. I heard you can't add php files to the cron. I will try it out though.

vbbnn

7:09 am on Aug 18, 2005 (gmt 0)

10+ Year Member



Use a system scheduled task to trigger yuor script.

jatar_k

4:57 pm on Aug 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> system scheduled task

that's cron for windows ;)

wfernley

5:05 pm on Aug 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Alright, well I just finished the cronjob and its working great.

Thanks again for all your help! :)

wes