How to get server-related information in PHP? In fact, with just three lines of code, you can easily obtain the relevant information of a file on the other end and the site information to which it belongs. The code is as follows:
$fp = fopen("http://www.***.com/***.htm","r"); / /Open a file under a site in read-only mode
foreach($http_response_header as $info) //Loop through the file information header of $http_response_header
echo $info."
"; //Finally output each record information
?>
In the information header, the content displayed includes whether the file exists, the file size, the file size, Type, encoding method, etc., and you can even get the server name and version number used by the site. If you open a file such as ASP or PHP, it also contains some additional information.