Awstats Summary via email

Hey guys,

Hope this is the right forum - does anyone know if there is currently a means where by I could email an awstats summary to the owner of the site.

I have awstats installed and it works 100%, but I dont want him/her loggin in every month to check the stats, I’d rather run a cronjob to email them.

Cheers,

Ronan

I’ve seen this script being asked for before at WebHostingTalk but never have I seen it answered :frowning: Sorry. I’d love to see this script too.

Cheers AussieGirl,

I’ll go and see if I can find anything else on the net … if so I’ll post it here.

G’luck

Ok - I’ve attempted to create a script to get the awstats file for the previous month. It uses cURL and mail().

Usage …

  1. Copy the stats_email.inc to your server (this is the email script - kindly borrowed from phpWizard - Modified by Tobias Ratschiller)

  2. You would add an entry in to cron to get call the stats.inc script on the 2nd of the month. This would then email the awstats for the previous month to the recipient(s). NOTE: Stats.inc needs to be modified for your domain.

Issues …

a. Currently only works for awstats.
b. Only seems to send to gmail address (instant) and AOL at present (took time to reach AOL address) - tested with hotmail as well, still not recieved.
c. Images do not appear in the report, meaning graphs arent coloured.
d. Coding might not be the best.

Please feel free to modify and work on - only request I as is that you post any new stuff back here for all to use …

Regards,

Ronan

I cleaned up and modified this script to make it easier for people to configure it. Unfortunately, the graphical components are still not part of the attachments so the graphs don’t work well in the AwStats report.

Feel free to iterate on what I have done :slight_smile:

Dave G.

Excellent work dave …

Yeah - that was a problem I was having … being able to grab the graphs/images … going to investigate curl a bit more to see if there is anyway to grab the images as well.

I was thinking … once you hit the page via curl in the browser the images are displayed … wonder could we make a PDF of it and use this in the mail?

Also, I wreckon it wouldnt be hard to modify the script to grab stats for Analog or Webalizer.

The thing is when you use display the result of curl in a browser, it is the browser that goes off and gets the images from the storage location – not curl. I was thinking of modifying all the different img directives (and there are a lot of different ones mainly due to different colors, etc) to use one simple image that I could include as an attachment to the email. I would also then want the report to actually be in the body of the email message so the email client would know how to embed the simple image properly.

The other possibility is to completely replace the img and modify the table cells with different background colors. The graphs would have the different colors but it would look flat.

Creating a PDF from the report might be another idea but I need to check for scripts out there that can render HTML into a PDF.

I might find time to work on this again this weekend… then again nice weather tends to pull me outside :slight_smile:

Dave G.