php get_headers 与get_meta_tags函数实例
来源:互联网 发布:gephi需要编程吗? 编辑:程序博客网 时间:2024/05/22 00:44
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等信息
*/
$tags=get_meta_tags('http://www.111cn.net/'); //提取meta标签
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,才能使用
- php get_headers 与get_meta_tags函数实例
- PHP中get_headers函数使用方法解析
- php中get_headers函数的作用和用法
- PHP下get_headers用法
- get_headers函数判断远程文件是否存在
- PHP函数实例
- php常用函数实例
- php经典实例-笔记3-类与函数篇
- php中base64_decode与base64_encode加密解密函数实例
- php中base64_decode与base64_encode加密解密函数实例
- Fatal error: Call to undefined function: get_headers() in /var/www/html/t.php on line 5
- php与Ajax实例
- php 时间转化函数实例
- PHP mysqli_fetch_object() 函数实例讲解
- PHP经典实例读书笔记--函数
- 【PHP】操作图片函数实例
- PHP递归函数实例详解
- php函数实例剖析函数的声明与定义方法并阐述其优点
- 新手报到
- 2010十大通信业热词发布
- js 与或运算符 || && 妙用
- 检测异常并打印堆栈
- 一个程序员的成长的六个阶段
- php get_headers 与get_meta_tags函数实例
- linux rpm相关使用
- 2级域名实现iframe域名跨域自适应高度
- PHP中使用curl取得HTTP状态码
- js解决鼠标移动到单元格上呈现手型 可点击 并移动上去变换图像
- Java非静态内部类和静态内部类,访问父类的非静态和静态成员变量及成员函数
- 在aspx,ashx页面挂起线程执行
- Calf Flac
- 从WikiLeaks维基解密事件看网络自由