http://cz2.php.net/fsockopen ?
fsockopen() returns a file pointer which may be used together with the other file functions (such as fgets(), fgetss(), fwrite(), fclose(), and feof()). If the call fails, it will return FALSE
Takže (snad víš co je ternární operátor):
$hostname = "poradna.net"; //Bez http://
$ports = array(80, 3306, 21, 5432);
foreach($ports as $port)
{
print $hostname;
print (fsockopen($hostname, $port, $errnum, $errstr, 2)) ? " má " : " nemá ";
print " aktivní port $port";
print "<br><br>";
}
PS: Gooooogle
