Home > Backend Development > PHP Tutorial > PHP accidentally obtains server-side information_PHP tutorial

PHP accidentally obtains server-side information_PHP tutorial

WBOY
Release: 2016-07-21 16:11:55
Original
815 people have browsed it

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313802.htmlTechArticleHow to get server-related information in PHP mode? In fact, with only three lines of code, you can easily obtain the relevant information of a file on the other end and the information of the site it belongs to. The code is as follows: ?p...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template