jmreinwald
Technical User
Hi all,
I am a rather green php programmer, and I've been given a project at work that I think I'm doing right. We have several portal servers that are on hot-swappable drives. At any time, there would only be 3 drives available out of the 9 or so portals we have. I have been tasked with creating a "monitoring" tool which will try and open each main page and return the link if it's available, or an "unavailable" message if it is not.
A couple of questions--it seems to 'think' a little longer than I think it should and eventually gives a blank page. Also, quite simply, is there an easier way of doing this?
Here's what I have so far (keep in mind I'm a newbie):
I obviously have a table that this is getting echo'ed to. Also, there are only three examples above, but the arrays will eventually hold all 9 urls and names.
What am I doing wrong?
Thanks!
I am a rather green php programmer, and I've been given a project at work that I think I'm doing right. We have several portal servers that are on hot-swappable drives. At any time, there would only be 3 drives available out of the 9 or so portals we have. I have been tasked with creating a "monitoring" tool which will try and open each main page and return the link if it's available, or an "unavailable" message if it is not.
A couple of questions--it seems to 'think' a little longer than I think it should and eventually gives a blank page. Also, quite simply, is there an easier way of doing this?
Here's what I have so far (keep in mind I'm a newbie):
Code:
<?
$msg =""; //string starter
$url = array("[URL unfurl="true"]http://website1/index.html",[/URL]
"[URL unfurl="true"]http://website2/index.html",[/URL]
"[URL unfurl="true"]http://website3/index.html");[/URL]
$name = array("Site 1",
"Site 2",
"Site 3");
$i = 0;
while ($i<=2) {
$f = @fopen($url[$i], 'r');
if($f)
{
$msg .= "<tr><td>$name[$i]</td><td><a href=\"$url[$i]\">Available</a></td></tr>\n";
}
else
{
$msg .= "<tr><td?$name[$i]</td><td>Unavailable</td></tr>\n";
}
$i++;
}
?>
I obviously have a table that this is getting echo'ed to. Also, there are only three examples above, but the arrays will eventually hold all 9 urls and names.
What am I doing wrong?
Thanks!