How can I obtain server information in PHP mode? In fact, you only need three lines of code to easily obtain the information about a file on the peer end and the information about the website to which the file belongs. The code is as follows :? Php $ fpfopen (www. ***. com ***. htm, r); open the file foreach ($ http_response_headeras $ info) in a site in read-only mode. how can I obtain server-related information in PHP mode? In fact, you only need three lines of code to easily obtain the information about a file on the peer end and the information about the website to which the file belongs. The code is as follows:
$ Fp = fopen ("http: // www. ***. com /***. htm "," r "); // open files under a site in read-only mode
Foreach ($ http_response_header as $ info) // traverse the file information header of $ http_response_header
Echo $ info ."
"; // Finally output the information of each record
?>
In the information header, the content displayed includes whether the file exists, the file size, file type, and encoding method, you can even obtain the server name and version number used by the site. If you open files such as ASP or PHP, additional information is contained.