php判断WebSERVER类型
时间:2007-02-17 来源:PHP爱好者
判断WebSERVER类型
关键词:PHP
判断WebSERVER类型
--------------------------------------------------------------------------------
function WebServerSpy($ServerURL)
{
$filepointer = fsockopen($ServerURL,80,&$errno,&$errstr);
if(!$filepointer)
{
$WebServer="Error: $errstr ($errno)
n";
}
else
{
fputs($filepointer,"GET / HTTP/1.0nn");
while(!feof($filepointer))
{
$WebServer=fgets($filepointer,4096);
if (ereg("^Server:",$WebServer))
{
$WebServer=trim(ereg_replace("^Server:","",$WebServer));
break;
}
}
fclose($filepointer);
}
return($WebServer);
}
?>
if ($ServerURL<>"") { $WebServer=WebServerSpy($ServerURL); }
?>
if ($WebServer<>"" and $ServerURL<>"")
{
echo("
Server $ServerURL is running $WebServer.
");
}
?>
http://
php爱好者 站 http://www.phpfans.net 网页制作|网站建设|数据采集.
关键词:PHP
判断WebSERVER类型
--------------------------------------------------------------------------------
function WebServerSpy($ServerURL)
{
$filepointer = fsockopen($ServerURL,80,&$errno,&$errstr);
if(!$filepointer)
{
$WebServer="Error: $errstr ($errno)
n";
}
else
{
fputs($filepointer,"GET / HTTP/1.0nn");
while(!feof($filepointer))
{
$WebServer=fgets($filepointer,4096);
if (ereg("^Server:",$WebServer))
{
$WebServer=trim(ereg_replace("^Server:","",$WebServer));
break;
}
}
fclose($filepointer);
}
return($WebServer);
}
?>
if ($ServerURL<>"") { $WebServer=WebServerSpy($ServerURL); }
?>
if ($WebServer<>"" and $ServerURL<>"")
{
echo("
Server $ServerURL is running $WebServer.
");
}
?>
http://
php爱好者 站 http://www.phpfans.net 网页制作|网站建设|数据采集.
相关阅读 更多 +