I'm hoping there is a quirk about apache/php that I'm missing.
The Code:
<?php
$servers = array(
array("70.89.xxx.226",25565,''),
array("50.22.xxx.147",25591,''),
);
foreach($servers as $key=>$server){
$fp = @fsockopen($server[0],$server[1],$errno,$errstr,.5);
if(!$fp) {
$servers[$key][2] = "DOWN";
} else {
$servers[$key][2] = "UP";
@fclose($fp);
}
unset($fp);
}
echo"
<table>
<thead>
<td>Minecraft Server Status</td>
</thead>";
foreach ($servers as $key=>$server){
$keyplus = $key + 1;
echo"
<tr>
<td>Server $keyplus: $server[0]:$server[1]</td>
<td>$server[2]</td>
</tr>";
}
echo "
</table>";
?>
What it does: check connectivity to a variety of minecraft servers with the fsockopen function.
The problem: This code does exactly what it's supposed to do on both my local and my remote web servers. However, on my remote server, the status always displays as DOWN even when I know they are UP, they also display as UP on my local server. I can't figure out WHY my host wouldn't be able to reach these servers, so I hope its a server quirk i don't know about.
How you can help: Maybe theres another way to effectively ping an IP in php that I could use? or maybe you know of a server setting that is effecting my connectivity.
thank for reading and your time ~TylerTofWA