PHPget_headers () function details. Get_headers: Send the server response HTTP request get_headers (string url [link format]) get_headers () to return the server HTTP request in an array. If the execution fails, FALSE and get_headers will be returned: Send the server to respond to the HTTP request
Get_headers (string url [link format])
Get_headers () returns the HTTP request of the server as an array. If the execution fails, FALSE and an error level E_WARNING are returned.
The optional parameter is set to 1. get_headers () can analyze the system response speed and the keys in the array.
Note: To use this function, you must use allow_url_fopen = On in php. ini.
Example:
$ Url = http://www.ite5e.com;
Print_r (get_headers ($ url ));
Print_r (get_headers ($ url, 1 ));
?>
Print result:
Array
(
[0] => HTTP/1.1 200 OK
[1] => Connection: close
[2] => Date: Tue, 16 Nov 2010 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, 16 Nov 2010 09:19:13 GMT
[7] => Accept-Ranges: bytes
[8] => ETag: "50d16c556f85cb1:b1f76"
[9] => Server: Microsoft-IIS/6.0
[10] => X-Powered-By: ASP.NET
)
Array
(
[0] => HTTP/1.1 200 OK
[Connection] => close
[Date] => Tue, 16 Nov 2010 09:48:21 GMT
[Content-Length] => 52708
[Content-Type] => text/html
[Content-Location] => http://www.ite5e.com/index.html
[Last-Modified] => Tue, 16 Nov 2010 09:19:13 GMT
[Accept-Ranges] => bytes
[ETag] => "50d16c556f85cb1:b1f76"
[Server] => Microsoft-IIS/6.0
[X-Powered-By] => ASP.NET
)
Response get_headers (string url [link format]) get_headers () returns the server HTTP request in the form of an array. If the execution fails, FALSE and... are returned...