<?php
/*
This script is used to validate that all of the websites in a list are operational.
It actually reads the contents of a file on each website.
This ensures the domain name is pointing where it should, the site is up, and at least one file is intact.
It can help identify unauthorized DNS changes, server outages, or global file issues.
It must be run from a server where none of the sites are located, or the DNS test will not be valid. << IMPORTANT POINT
/
The script assumes that each site has a file named site_test.txt at the document root.
That file must contain the text "The site is up" (no quotes or line break).
/
The only alteration to the script should be the $filename variable, which has the location of the domain name file.
The domain name file is a text file with the domain names listed (i.e. example.com) one per line.
The domain name file can be located on any server (you can use a url location).
/
The output of the script will list the domain names in green (OK) or red (problem).
This script will not identify the specific problem with a domain, only that there is a problem.
*/
$filename = "domain_names.txt";
$site = file($filename);
echo "<span style='font-weight: bold;'>Domain Validation</span><br>";
foreach ($site as $domain) {
$domain = preg_replace("#\r\n?|\n#", "", $domain);
$testFile = @file_get_contents("http://" . $domain . "/site_test.txt");
if ($testFile == "The site is up")
echo "<span style='color: green;'>$domain</span><br>";
else
echo "<span style='color: red;'>$domain</span><br>";
}
?> |