Server type from a given URL
What is 开发者_如何学编程the PHP function to get the server type and information from a given 'URL'?
PHP doesn't has a built in function to get that type of information (which is rarely useful unless you have easier ways to get it that don't involve programming, or unless you are planning to attack the server).
It is possible to make an educated guess about what the server is by examining HTTP response headers (which somethings declare information about what the server is, sometimes don't and sometimes lie).
I believe it is also possible to do low level network testing to look for oddities about how it responds and use that information as a fingerprint.
The ($_SERVER
) array is only available on the Server php is running on as are all php variables.
If you have access to the Server you can use ($_SERVER
) and phpinfo to get informations. If you don't you should use another tool to examine the server like: nmap
.
$_SERVER works only on localhost but you should give it a try
you can get some information if server administrator haven't changed server signature.. like when you go to a 404 error link apache send information in line the end of the page and you can get it using fopen() function...
I don't think there's other way to do it.. and if you found another way to do it please post it here
精彩评论