Welcome to WebmasterWorld Guest from 54.147.63.124

Forum Moderators: phranque

Message Too Old, No Replies

Being notified of particular server requests

How to have an email sent?

     
5:40 pm on Aug 12, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:June 26, 2004
posts:155
votes: 0


I would like to be sent an email whenever a particular server request is made, such as from a particular IP address for a specific page. The notification doesn't have to be immediate; within the hour would be fine. This is on an Apache server on a Unix box. Are there scripts available to do this?
5:51 pm on Aug 12, 2007 (gmt 0)

Junior Member

5+ Year Member

joined:June 20, 2007
posts:42
votes: 0


Are you using PHP? Here is something I've used.

// create an array of watched IP addresses
$watchedIPs = array('x.x.x.x','x.x.x.x');

// check the remote address against the array of IP addresses
for($i=0, $num=sizeof($watchedIPs); $i<$num; $i++){
if(strpos($_SERVER['REMOTE_ADDR'],$watchedIPs[$i])!== false){
/* send a notification email */
}
}
7:05 pm on Aug 12, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:June 26, 2004
posts:155
votes: 0


Thanks, but except for the search box my site is entirely static.

I can use PHP, but I don't know whether I could intercept the request and deal with it on the fly? Or whether I'd need to process the log file once an hour?

6:45 am on Aug 13, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Since the request is for a static page, only the web server software is "aware" of the page being requested.

Check out the capabilities of the mod actions [httpd.apache.org] module, it would be a very simple thing to write a script to do this. You could even write it in PHP and have the module execute it for you, although perl is probably more adept at command line scripting.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members