如何显示网站';s的头信息


How to display a website's header information with PHP?

如何使用php 获得类似此网页(如下)的标题信息

此网站检查网站HTTP服务器头信息

结果:

HTTP Status for: "http://www.abc.com"
The title is: ""
Keywords: ""
Description: ""
HTTP/1.1 200 OK
Date: Fri, 22 Feb 2013 12:00:56 GMT
Server: Apache/2.2.3 (Debian) PHP/4.4.4-8+etch6
X-Powered-By: PHP/4.4.4-8+etch6
Keep-Alive: timeout=300
Connection: Keep-Alive
Content-Type: text/html

使用PHPs函数get_headers:

$headers = get_headers($url, 1);

请参阅:http://php.net/manual/en/function.get-headers.php

如果您还想要元关键字元数据描述,请使用get_meta_tags():

$tags = get_meta_tags($url);

您可以使用PHP函数get_header();。此函数将返回一个包含所有标头字段的数组。

有关更多信息,请参阅:http://php.net/manual/en/function.get-headers.php

您可以使用:

print_r(get_headers($url));