if (($socket = fsockopen( $ip, $port, &$errno, &$errstr, $timeout))
{
echo "Somebody is at least listening on port 80";
fclose($socket);
}
else
{
echo "No response on port $port within $timeout seconds: ";
echo "$errstr ($errno)";
}