note 28661 added to function.fsockopen

From: Date: Mon, 20 Jan 2003 06:14:31 +0000
Subject: note 28661 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-42409@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. -- http://www.php.net/manual/en/function.fsockopen.php http://master.php.net/manage/user-notes.php?action=edit+28661 http://master.php.net/manage/user-notes.php?action=delete+28661 http://master.php.net/manage/user-notes.php?action=reject+28661

« previous php.notes (#42409) next »