How can I obtain server information in PHP mode? In fact, you only need three pieces of code to easily obtain the information about a file on the peer end and the site information.
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
$ 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.
Simpler method
$ Fp = fopen ("http: // www. ***. com /***. htm "," r "); // open files under a site in read-only mode
Print_r (stream_get_meta_data ($ fp ));