haro Posted June 19, 2010 Share Posted June 19, 2010 Hi, I know there are several services to check if your site is available/online. But I would like to implement myself such a site monitor/check script. Because only a check if the server is available does not detect if your cms gives an error message or if there is something wrong with dns, I would prefer a method where I add a certain string in the first part of the html of the homepage and then the script should check every hour or so if that word/string is still present and if not (which would mean site offline) send an email alert. How would I do this in php? I know the easy parts like how to set cron to run the script every hour and know how to let php send emails, but how could I from another site open a page and check for a word/string if its present? Thanks, Hans Link to comment https://forums.phpfreaks.com/topic/205248-site-online-check-script/ Share on other sites More sharing options...
cags Posted June 19, 2010 Share Posted June 19, 2010 file_get_contents, fopen or cURL should fetch the contents of the page, you then just use preg_match or one of the string functions to detect the string in question. Link to comment https://forums.phpfreaks.com/topic/205248-site-online-check-script/#findComment-1074340 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.