0
對於iPhone通知我們需要2195端口是開放的。我們如何檢查2195端口是否在該服務器或主機上打開?如何檢查服務器或主機上的開放端口?
對於iPhone通知我們需要2195端口是開放的。我們如何檢查2195端口是否在該服務器或主機上打開?如何檢查服務器或主機上的開放端口?
$host = 'stackoverflow.com';
$ports = array(21, 25, 80, 81, 110, 443, 3306);
foreach ($ports as $port)
{
$connection = @fsockopen($host, $port);
if (is_resource($connection))
{
echo '<h2>' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "\n";
fclose($connection);
}
else
{
echo '<h2>' . $host . ':' . $port . ' is not responding.</h2>' . "\n";
}
}
出把看這個
stackoverflow.com:21 is not responding.
stackoverflow.com:25 is not responding.
stackoverflow.com:80 (http) is open.
stackoverflow.com:81 is not responding.
stackoverflow.com:110 is not responding.
stackoverflow.com:443 is not responding.
stackoverflow.com:3306 is not responding.
感謝的答覆一樣,但是這個代碼不給正確的結果 – baljeet