$sock = fsockopen(ip,port,...);if($sock) {$connectable = "yes";fclose();} else {$connectable = "no";}