get_headers is to get the http header information, get_meta_tags is to get the description, abstract, keywords and other information of the web page
get_headers is to get the http header information, get_meta_tags is to get the description, abstract, keywords and other information of the web page
*/
$url='http://www.bKjia.c0m'; //Define url
print_r(get_headers($url)); //Get without format
print_r(get_headers($url,1)); //Get the format
/*
array
(
[0] => http/1.1 200 ok
[1] => connection: close
[2] => date: sat, 11 dec 2010 05:43:46 gmt
[3] => content-length: 69617
[4] => content-type: text/html
[5] => content-location: http://www.bKjia.c0m/index.html
[6] => last-modified: sat, 11 dec 2010 05:19:51 gmt
[7] => accept-ranges: bytes
[8] => etag: "e8be4b9f398cb1:6c66"
[9] => server: microsoft-iis/6.0
[10] => x-powered-by: asp tutorial.net
)
array
(
[0] => http/1.1 200 ok
[connection] => close
[date] => sat, 11 dec 2010 05:43:47 gmt
[content-length] => 69617
[content-type] => text/html
[content-location] => http://www.bKjia.c0m/index.html
[last-modified] => sat, 11 dec 2010 05:19:51 gmt
[accept-ranges] => bytes
[etag] => "e8be4b9f398cb1:6c66"
[server] => microsoft-iis/6.0
[x-powered-by] => asp.net tutorial
)
get_meta_tags($url);
Get the description, abstract, keywords and other information of the specified web page
*/
$tags=get_meta_tags('http://www.bKjia.c0m/'); //Extract meta tags
print_r($tags) //Output the entire contents of the array
/*
array
(
[description] => The webpage production tutorial website provides professional webpage design tutorials and webpage production tutorials, including photoshop tutorials, flash, html, css tutorials, dreamweaver, fireworks, asp, php tutorials, jsp tutorials, asp.net, website construction, Website development, web special effects, graphic design, personal website, web material
[abstract] => Provides the latest webpage production tutorials, webpage design tutorials, webpage special effects, webpage material templates and webpage video learning for personal websites.
[keywords] => Web design tutorials, web production tutorials, web learning, photoshop, flash, html, css, dreamweaver, fireworks, asp, php, jsp, asp.net, web special effects, graphic design, web materials
)
Note: To use this function, you need to set allow_url_fopen = on in php.ini to use it