Monthly Archives: March 2010
Protected: Health Update
Posted by Noah
on March 30, 2010
Enter your password to view comments.
Protected: You keep saying that…I do not think it means what you think it does
Posted by Noah
on March 24, 2010
Enter your password to view comments.
Monitor a web server using PHP
Posted by Noah
on March 23, 2010
No comments
function check($host, $find)
{
$fp = fsockopen($host, 80, $errno, $errstr, 10);
if (!$fp)
{
echo "$errstr ($errno)\n";
}
else
{
$header = "GET / HTTP/1.1\r\n";
$header .= "Host: $host\r\n";
$header .= "Connection: close\r\n\r\n";
fputs($fp, $header);
while (!feof($fp))
{
$str .= fgets($fp, 1024);
}
fclose($fp);
return (strpos($str, $find) !== false);
}
}
function alert($host)
{
mail('youremail@gmail.com', 'Monitoring', $host.' down');
}
$host = 'www.monkeyguild.org';
$find = 'Monkeyninja Code';
if (!check($host, $find)) alert($host);
Protected: I forgot how much I love Truman Capote
Posted by Noah
on March 17, 2010
Enter your password to view comments.