<?php
$fp = @fsockopen("127.0.0.1", 80, $errno, $errstr, 1);
   $out = "GET / HTTP/1.1\r\n";
   $out .= "Host: 127.0.0.1\r\n";
   $out .= "Connection: Close\r\n\r\n";
if ($fp)
{
    echo  '您电脑上的80端口可能被以下程序占用:

';
   fwrite($fp, $out);
   while (!feof($fp)) 
   {
        $line = fgets($fp, 128);
        if (ereg('Server: ',$line))
        {
           
            echo $line;
            $got_info = 1;
        }  
        
    }
    fclose($fp);
    if ($got_info != 1)
        echo '端口信息获取不准确，请重试打开服务器。或上www.php.cn发帖询问！';
}
else
{
    echo '您的80端口并未使用。';
}


echo '

请按下回车退出检测...';
trim(fgets(STDIN));


?> 