PHP file_get_contents 获取请求返回头信息
PHP file_get_contents 获取请求返回头信息Code:
file_get_contents("http://example.com");
var_dump($http_response_header);
Output:
array(9) {
=>
string(15) "HTTP/1.1 200 OK"
=>
string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT"
=>
string(29) "Server: Apache/2.2.3 (CentOS)"
=>
string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT"
=>
string(27) "ETag: "280100-1b6-80bfd280""
=>
string(20) "Accept-Ranges: bytes"
=>
string(19) "Content-Length: 438"
=>
string(17) "Connection: close"
=>
string(38) "Content-Type: text/html; charset=UTF-8"
}
http://stackoverflow.com/questions/2107759/php-file-get-contents-and-headers
页:
[1]