抓取网页swf内容
来源:互联网 发布:linux c编程实战pdf 编辑:程序博客网 时间:2024/06/04 23:21
用curl拿到网页里的swf播放器,示例【知牛直播】
//php代码public function zhiNiuLive($id = '1488869239') { //curl操作 $url = "http://www.zhiniu8.com/live/".$id; $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); //除去乱码 $dom = new DOMDocument(); $meta = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>'; @$dom->loadHTML($meta.$file_contents); //获取部分内容 $textContent = $dom->textContent; //匹配获取直播间id和播放器id $anchorUidReg = '/anchorUid: "[0-9]+"/'; $liveRoomTopIdReg = '/liveRoomTopId: "[0-9]+"/'; $liveRoomSubIdReg = '/liveRoomSubId: "[0-9]+"/'; $idReg = '/[0-9]+/'; preg_match($anchorUidReg, $textContent, $anchorUid); preg_match($liveRoomTopIdReg, $textContent, $liveRoomTopId); preg_match($liveRoomSubIdReg, $textContent, $liveRoomSubId); preg_match($idReg, $anchorUid[0], $Uid); preg_match($idReg, $liveRoomTopId[0], $TopId); preg_match($idReg, $liveRoomSubId[0], $SubId); $swf = "http://weblbs.yystatic.com/s/".$TopId[0]."/".$SubId[0]."/finscene.swf"; $data['swf'] = $swf; $this->load->view('user/header', $data); $this->load->view('user/live', $data); $this->load->view('user/footer', $data); }
//live视图文件代码<style>.live{margin:0 auto;width:1000px;} </style><div class="live"> <embed align="middle" allowfullscreen="true" allowscriptaccess="always" height="600px" mode="transparent" quality="high" src="<?php echo $swf; ?>" type="application/x-shockwave-flash" width="100%"/></div>
0 0
- 抓取网页swf内容
- JAVA 抓取网页内容
- 【JAVA】 抓取网页内容
- 网页内容抓取
- 网页内容抓取
- fsockopen 抓取网页内容
- JAVA 抓取网页内容
- 抓取网页内容
- lotusscript 抓取网页内容
- C# 抓取网页内容
- PHP抓取网页内容
- java 抓取网页内容
- 抓取网页内容
- 抓取网页内容
- 读取 抓取 网页内容
- 网页内容抓取
- C# 抓取网页内容
- 抓取网页内容
- Android 6.0 指纹识别功能详细分析
- html video poster 属性 重复请求页面
- JS获取url参数
- java 动态代理(JDK和Cglib)
- Java分布式应用技术架构介绍
- 抓取网页swf内容
- 文件上传类
- MapReduce任务参数调优
- 深度学习学习笔记(一)
- linux部署web项目
- 【稀饭】react native 实战系列教程之自定义原生UI组件
- mysql 创建 主键索引 唯一索引 全文索引 多列索引 添加索引
- 模仿win10样式,基于jquery的时间控件
- this和super的区别