Here is the problem. I have over 60 subdomains to check on a regular basis. I wrote
a php script
that gets a list from a text file and then checks whether it can open that
domain/subdomain. That
works great. My problem is that everything is lumped together, so I have to scan a
list of 60
names for the one that fails, I also get 1 email for each time the check fails.
How can I get a list broken up by failed and passed, and only get one email with a
list of the
subdomains that failed.
Here is the script as it stands now.
<?php
$url_file = "url.txt";
$url_list = file($url_file);
for($x = 0; $x < count($url_list); $x++)
{
$url_list[$x] = eregi_replace("[\n\r]","",$url_list[$x]);
$fp = fsockopen ($url_list[$x], 80, $errno, $errstr, 30);
if (!$fp) {
echo "<b>$url_list[$x]</b> has an error. $errstr ($errno)<br>\n";
//$subject = "A URL test has failed";
//$message = "$url_list[$x] has an error. $errstr
($errno)\r\n";
/*mail("[EMAIL PROTECTED]", $subject, $message, "From:
[EMAIL PROTECTED]\r\n"
."Reply-To: [EMAIL PROTECTED]\r\n"
."X-Mailer: PHP/" . phpversion());*/
} else {
echo "<b>$url_list[$x]</b> is up.<br>\n";
}
}
?>
=====
--------------------------------------------------------
"Theres no such thing as a problem unless the servers are on fire!"
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php