One of our customers said they have a very simple script which uses fsockopen() to determine whether a server is online or not. They said until recently it worked fine on their website through us, but recently just stopped working, so I am assuming it is a setting.
My first thought was that he was using it as TCP and using the IP/Port for a Game Server, however he and myself both confirmed the script worked fine from various other web hosts.
What could be the issue on ours in particular?
Works: http://crazygfl.xfactorservers.com/query.php?ip=www.xfactorservers.com&port=80
Works: http://crazygfl-stats.com/query.php?ip=109.73.163.231&port=27015
Doesn't Work: http://crazygfl.xfactorservers.com/query.php?ip=109.73.163.231&port=27015
Here is the code...
<?php
$timeout = (isset($_GET['timeout']) ? ($_GET['timeout'] <= 0 ? 30 : ((int)$_GET['timeout'])) : 30);
if(empty($_GET['ip'])&&empty($_GET['port'])){
echo 'No IP/Port specified.';
}else{
if(fsockopen($_GET['ip'], $_GET['port'], $errno, $errstr, $timeout) === false){
echo 'offline';
}else{
echo 'online';
}
}