Get_headers: The sending server responds to HTTP requests
Get_headers (string url[link format])
Get_headers () returns the server HTTP request in the form of an array. If execution fails, it will return false and an error in the horizontal e_warning ".
The optional parameter is set to 1,get_headers () to analyze the system's response speed and the keys in the set array.
Note: Use this function to use Allow_url_fopen = on in php.ini.
examples are as follows:
$url = http://www.ite5e.com;
Print_r (Get_headers ($url));
Print_r (Get_headers ($url, 1));
?>
Print Results:
Array
(
[0] = = http/1.1-OK
[1] = Connection:close
[2] = Date:tue, 09:48:20 GMT
[3] = content-length:52708
[4] = content-type:text/html
[5] = content-location:http://www.ite5e.com/index.html
[6] = Last-modified:tue, 09:19:13 GMT
[7] = Accept-ranges:bytes
[8] = ETag: "50d16c556f85cb1:b1f76"
[9] = server:microsoft-iis/6.0
[Ten] = X-powered-by:asp.net
)
Array
(
[0] = = http/1.1-OK
[Connection] = Close
[Date] = Tue, 09:48:21 GMT
[Content-length] = 52708
[Content-type] = text/html
[Content-location] = http://www.ite5e.com/index.html
[Last-modified] = Tue, 09:19:13 GMT
[Accept-ranges] = bytes
[ETag] = "50d16c556f85cb1:b1f76"
[Server] = microsoft-iis/6.0
[x-powered-by] = ASP.
)
http://www.bkjia.com/PHPjc/486068.html www.bkjia.com true http://www.bkjia.com/PHPjc/486068.html techarticle Get_headers: The sending server responds to HTTP request get_headers (string url[link format]) get_headers () returns the server HTTP request as an array. If execution fails, it will return false and a ...