Php远程检查Web服务器正在使用的操作系统

Is there a way to check a external websites webserver OS is Linux or Windows in php? I have a web development business and we mainly work on only Linux hosting etc. It would save so much time if I didn't have to find out if a client has a Linux or Windows webserver.

You would get the information if the web server exposes it. By default, Apache lets you know a few things including the Server OS. Just have a look at the site's headers.

Try this code it will hopefully work

$info = get_headers($url); $string0 = implode(' ', $info); $string1 = explode('Server:', $string0);
$pattern = '#^Server:#i'; $matches = preg_grep($pattern, $info);