Skip to content

Instantly share code, notes, and snippets.

@gcphost
Created July 9, 2015 18:50
Show Gist options
  • Save gcphost/8720d4e183154015e4bb to your computer and use it in GitHub Desktop.
Save gcphost/8720d4e183154015e4bb to your computer and use it in GitHub Desktop.
Simple PHP Website Status Check and Report
<?php
$failed=true;
if($site=file_get_contents('http://google.com')){
if(preg_match('/google/', $site)) $failed=false;
# Maybe your sites online but has an error..
# if(preg_match('/Something went wrong/', $site)) $failed=true;
}
if($failed) mail('you @ tld.com', 'Site OFFLINE', 'WTF dude!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment