Bradly Spicer
Bradly Spicer

Reputation: 2318

does fsockopen only allow certain servers?

So I recently got round to contacting Hostgator about a previous Plugin I started which returns "Online" or "Offline" depending on the server status.

Now, here is the issue.

Hostgator had fsockopen disabled and after harassing them I had it Enabled. But not all server ips and ports work with it?

for example:

<?php
$ip = "play.magicacraft.net";
$port = "25567";

$online = @fsockopen( $ip, $port, $errno, $errstr, 200);
if($online >= 200) { 
echo '<a href="#" class="MPServer_Online">Online</a>'; 
}
else {
echo '<a href="#" class="MPServer_Offline">Offline</a>'; 
} 
?>

That for me returns as online.

If i use another server ip and port such as:

$port = 72.20.55.85";
$ip = "25570";

It says offline ever though it's online

Is this a fault on my end or theirs? I question this because sites such as http://minecraftservers.org/index/1 can access this information and I can't.

Thanks for your time

Upvotes: 0

Views: 835

Answers (1)

MagePal Extensions
MagePal Extensions

Reputation: 17656

Did you check to make sure that port is not block by a firewall/iptables?

Try the default example using port 80 http://php.net/manual/en/function.fsockopen.php to see if it could be a port block issue

Upvotes: 1

Related Questions