雨哲插件

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
雨哲插件 资料库 Discuz!X相关教程 php中获取远程页面http头部信息的方法
  • 全部资料
  • 查看资料

php中获取远程页面http头部信息的方法

2018-5-24 00:20|分类: Discuz!X相关教程 |发布用户: 雨哲

第一种:php自带函数 get_headers($url);
$arr = get_headers('http://www.baidu.com');
print_r($arr);
第二种:打印$http_response_header变量。该变量在脚本中调用get_headers 或者使用file_get_contents($url后生效)
$html=file_get_contents('http://www.baidu.com');
print_r($http_response_header);
第三种:使用fread fopen之类函数,然后用stream_get_meta_data函数获取打开文件数据流信息
$fp=fopen('http://www.baidu.com','r');
//print_r($http_response_header);
print_r(stream_get_meta_data($fp));
分享到: 手机访问 分享给QQ好友 分享到QQ 分享到QQ空间 QQ空间 分享到新浪微博 新浪微博 分享到人人 人人网

手机扫码访问

企业微信 : 雨哲手机扫描添加到联系人手机扫描直接访问

QQ|关于我们|Archiver|手机版|小黑屋|雨哲插件

GMT+8, 2024-5-20 01:57 , Processed in 0.224301 second(s), 11 queries , Xcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

返回顶部