index.php

<?php
include_once 'simple_html_dom.php';
//获取html数据转化为对象
$html = file_get_html('http://paopaotv.com/tv-type-id-5-pg-1.html');
//A-Z的字母列表每条数据是在id=letter-focus 的div内class= letter-focus-item的dl标签内,用find方法查找即为
$listData=$html->find("#letter-focus .letter-focus-item");//$listData为数组对象 foreach($listData as$key=>$eachRowData){
  $filmName=$eachRowData->find("dd span",)->plaintext;//获取影视名称   $filmUrl=$eachRowData->find("dd a",)->href;//获取dd标签下影视对应的地址   //获取影视的详细信息
  $filmInfo=file_get_html("http://paopaotv.com".$filmUrl);
  $filmDetail=$filmInfo->find(".info dl");
  foreach($filmDetail as $film){
    $info=$film->find("dd");
    $row=null;
    foreach($info as $childInfo){
      $row[]=$childInfo->plaintext;
    }
    $cate[$key][]=join(",",$row);//将影视的信息存放到数组中
  }
}
?> <table border="1px solid red" width="100%">
  <tr>
    <th>主演</th>
    <th>状态</th>
    <th>类型</th>
    <th>地区</th>
    <th>标签</th>
    <th>导演</th>
    <th>时间</th>
    <th>年份</th>
  </tr> <?php foreach ($cate as $val){
echo "<tr>";
  for ($i=; $i < count($val)-; $i++) {     echo "<td>".$val[$i]."</td>";
  }
echo "</tr>";
} ?> </table> <?php
echo "<pre>";
print_r($cate);
echo "</pre>"; ?> 相关代码下载:files.cnblogs.com/files/qhorse/getspider.rar

php抓取网页信息的更多相关文章

  1. HttpClient+Jsoup 抓取网页信息(网易贵金属为例)

    废话不多说直接讲讲今天要做的事. 利用HttpClient和Jsoup技术抓取网页信息.HttpClient是支持HTTP协议的客户端编程工具包,并且它支持HTTP协议. jsoup 是一款基于 Ja ...

  2. .net抓取网页信息 - Jumony框架使用1

    往往在实际开发中,经常会用到一些如抓取网站信息之类的的操作,往往大家采用的是用一些正则的方式获取,但是有时候正则是很死板的,我们常常试想能不能使用jquery的选择器,获取符合自己要求的元素,然后进行 ...

  3. Powershell抓取网页信息

    一般经常使用invoke-restmethod和invoke-webrequest这两个命令来获取网页信息,如果对象格式是json或者xml会更容易 1.invoke-restmethod 我们可以用 ...

  4. 一、使用 BeautifulSoup抓取网页信息信息

    一.解析网页信息 from bs4 import BeautifulSoup with open('C:/Users/michael/Desktop/Plan-for-combating-master ...

  5. C# 使用HtmlAgilityPack抓取网页信息

    前几天看到一篇博文:C# 爬虫 抓取小说 博主使用的是正则表达式获取小说的名字.目录以及内容. 下面使用HtmlAgilityPack来改写原博主的代码 在使用HtmlAgilityPack之前,可以 ...

  6. shell脚本抓取网页信息

    利用shell脚本分析网站数据 # define url time=$(date +%F) mtime=$(date +%T) file=/abc/shell/abc/abc_$time.log ht ...

  7. Fiddle无法抓取网页信息或HTTPS

    1:清除电脑根证书: 打开dos命令框,输入:certmgr.msc ![file](https://img2018.cnblogs.com/blog/1023158/201912/1023158-2 ...

  8. C# 使用 Abot 实现 爬虫 抓取网页信息 源码下载

    下载地址 ** dome **

  9. java模拟用户登录(排除没有验证码情况下,抓取网页信息)

    import java.io.BufferedInputStream;import java.io.BufferedReader;import java.io.IOException;import j ...

随机推荐

  1. ZJOIDay2T1 BB题解

    讲道理我是调不出来了... 考虑对序列按下标维护每个节点最后的树. 那么 改操作点 - 把一段连续的节点改父亲 加点/删点(注意拆成两个操作了) 插儿子 那么用seg维护一下下标, 用ETT维护Dep ...

  2. PHP 常量

    1.__NAMESPACE__           http://php.net/manual/zh/language.namespaces.nsconstants.php

  3. 【SpringBoot】SpringBoot 入门示例

    参考资料: http://www.tuicool.com/articles/mqeee2A http://www.cnblogs.com/suncj/p/4065589.html http://spr ...

  4. Print Common Nodes in Two Binary Search Trees

    Given two Binary Search Trees, find common nodes in them. In other words, find intersection of two B ...

  5. 饿了么 openapi demo

    http://merchant.openapi.eleme.io/merchant.html#id215 class Program { static void Main(string[] args) ...

  6. div加jquery实现iframe标签的功能

    由于最近项目需要,前端后台都完全采用div+css的方式布局.因而左思右想,有什么办法可以替代常用的iframe上下左右的布局方式,而且页面只是局部刷新.参考了许多前辈的资料,并加以整理,因而有了以下 ...

  7. Selenium WebDriver 处理cookie

    在使用webdriver测试中,很多地方都使用登陆,cookie能够实现不必再次输入用户名密码进行登陆. 首先了解一下Java Cookie类的一些方法. 在jsp中处理cookie数据的常用方法: ...

  8. SAP SMARTFORMS-基于内存方式在report程序中传递数据到smartforms显示

    一.准备工作 1.新建include程序 1> include程序名字:ZDD_INC_0104 2> ZDD_INC_0104  程序中的内容为 2.使用T-CODE :SE11新建两个 ...

  9. HTML5 video 支持air play

    < video src="/path/to/video.mp4" x-webkit-airplay="allow" preload controls> ...

  10. 【linux】linux下运行java程序

    参考了http://www.cnblogs.com/howard-queen/archive/2012/01/30/2331795.html 第一步:用vim先写一个java程序  first.jav ...