-1

I was wondering if it would be possible to have an email notification sent to my emails when a web page is updated? How would I go about this?

I found this code from another question on here, it sounds kind of similar but not exactly, would this be able to be edited to my needs or would I need something different?:

PHP - Email notification whenever a remote file changes

Thanks for any help.

Community
  • 1
  • 1
Josh Carney
  • 29
  • 2
  • 6
  • What do you mean by a web page being updated? Is that through PHP code you've written, or something else? – andrewsi Sep 14 '12 at 20:32
  • It seems to me it's an exact duplicate, a web-page is a file, so yes, you can use almost the exact same script. – jeroen Sep 14 '12 at 20:35
  • I'm sorry, I'm not very good at explaining. I mean like if someone edits the file of a specific page on a website, say http://www.website.com/index.html, if they edited index.html I would get a notification in an email. I wanted something like this so I could monitor people editing pages on my website. Thanks. – Josh Carney Sep 14 '12 at 20:37
  • Also jeroen, how do I use that script, would I have to run it through a cron job? If so what would be the command for that. Or does it just run on it's own? Thanks. :) – Josh Carney Sep 14 '12 at 20:38
  • 1
    Have you tried anything at all? Also, if it is on your own web-site, how do people edit web-pages, via a CMS, ftp, etc.? – jeroen Sep 14 '12 at 20:40
  • I tried that script from the link I showed above, and tried running it through a cron job, but it just sent me the email every minute rather than just when the file is updated. People edit the web pages through FTP or cPanel. – Josh Carney Sep 14 '12 at 20:42
  • Sounds like you could benefit from a [Continuous Integration](http://phpundercontrol.org/) and some sort of CVS tool. – ficuscr Sep 14 '12 at 20:44

1 Answers1

0

Long time ago i had simular request, therefore I build little bash script that will check it

#!/usr/bin/env bash
url = "http://URL"
checkfile = "/tmp/URL.md5"
email  = "my@example.com"
savefile = "/dev/null"
[ -f ./pagecheck ] \
    && \
  (diff $(wget -O $savefile $url | md5sum) $checkfile) && mail -s "UPDATED: $url" $email) \
|| \
(wget -O $savefile $url | md5sum > $checkfile)

I know it's not exactly what you are looking for but something simular you can build in PHP. I hope it helps.

confiq
  • 2,795
  • 1
  • 26
  • 43