search
Homephp教程php手册php get_headers 与get_meta_tags函数实例

get_headers是获取http头信息,get_meta_tags是获取网页的description,abstract,keywords等信息 */ $url='http://www.111cn.net';//定义url print_r(get_headers($url));//无格式获取 print_r(get_headers($url,1));//带上格式获取 /* array ( [0] = http/1.

get_headers是获取http头信息,get_meta_tags是获取网页的description,abstract,keywords等信息
*/
$url='http://www.111cn.net';          //定义url
print_r(get_headers($url));         //无格式获取
print_r(get_headers($url,1));         //带上格式获取


/*

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.111cn.net/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教程 .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.111cn.net/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教程
)

get_meta_tags($url);
获取指定网页的description,abstract,keywords等信息
*/


print_r($tags)            //输出数组全部内容

/*

array
(
    [description] => 网页制作 教程网提供专业网页设计教程与网页制作教程包括有photoshop教程 ,flash,html,css教程 ,dreamweaver,fireworks,asp,php教程 ,jsp教程 ,asp.net,网站 建设,网站开发,网页特效 ,平面设计 ,个人网站,网页素材
    [abstract] => 提供最新的网页制作教程、网页设计教程、网页特效,为个人网站提供网页素材模板和网页视频学习。
    [keywords] => 网页设计教程,网页制作教程,网页学习,photoshop,flash,html,css,dreamweaver,fireworks,asp,php,jsp,asp.net,网页特效,平面设计,网页素材
)

注意:使用该函数需要把 php.ini里面的allow_url_fopen = on,才能使用

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use