note 28661 rejected from function.fsockopen by victor
| From: | victor@php.net | Date: | Mon, 20 Jan 2003 07:38:01 +0000 |
| Subject: | note 28661 rejected from function.fsockopen by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42413@lists.php.net to get a copy of this message | ||
A couple of brief questions on this function, maybe someone can help me out?
Here's what I've got so far, and it works like a charm for what I want it to do:
function check($port, $host)
{
$errno="";
$errstr="";
$fp = fsockopen ($host, $port, $errno, $errstr, 30);
if (!$fp) {
$result = mysql_query("select * from monitor where server_address='$host'");
while ($row = mysql_fetch_array($result)) {
$sid=$row[server_id];
}
update_down ($sid, $port);
} else {
$result = mysql_query("select * from monitor where server_address='$host'");
while ($row = mysql_fetch_array($result)) {
$sid=$row[server_id];
}
update_up ($sid, $port);
fclose ($fp);
}
Basicaly that checks ports for activity. IE: if this is up, then it doesn't do anything. If
it's down, it notifies me via SMS.
The problem is that on a server (or three), apache (80) seems to segfault occasionally, and when it
starts back up, it doesn't FULLY start back up, because 443 (SSL) is running, but port 80 is
activated.
The question:
Is there a way to rewrite that and have that expect some phrase (ie: <title>This is my
site.com</title>) or something like that? And how would one go about doing it?
Thoughts? Ideas?
My apologies if this doesn't belong here.