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. json方式封装接口通信

    编写response类: <?php class response{ /** * 按json方式输出通信数据 * @param integer $code 状态码 * @param string ...

  2. Resizing the disk space on Ubuntu Server VMs running on VMware ESXi 5

    from: http://www.joomlaworks.net/blog/item/168-resizing-the-disk-space-on-ubuntu-server-vms-running- ...

  3. JavaScript——事件模型

    DOM事件流: DOM(文档对象模型)结构是一个树型结构,当一个HTML元素产生一个事件时,该事件会在元素结点与根节点之间按特定的顺序传播,路径所经过的节点都会收到该事件,这个传播过程可称为DOM事件 ...

  4. Qt5.4 MSVC mysql驱动编译;

    http://www.mysql.com/ 下载mysql http://download.qt.io/archive/qt/     Qt 下载 1. mysql安装源码 注意勾选这一步,将mysq ...

  5. adb操作命令详解及大全

    adb是什么?:adb的全称为Android Debug Bridge,就是起到调试桥的作用.通过adb我们可以在Eclipse中方面通过DDMS来调试Android程序,说白了就是debug工具.a ...

  6. hdu 5442 (ACM-ICPC2015长春网络赛F题)

    题意:给出一个字符串,长度是2*10^4.将它首尾相接形成环,并在环上找一个起始点顺时针或逆时针走一圈,求字典序最大的走法,如果有多个答案则找起始点最小的,若起始点也相同则选择顺时针. 分析:后缀数组 ...

  7. ios UITextView 计算文字内容大小

    先设置好 textView的内容文字,再调用以下代码,就能够得到文字内容的size,其中参数表示最大的size的尺寸,通常,高度应该不限制,宽度是控件的宽度. let newSize = statem ...

  8. Java for LeetCode 212 Word Search II

    Given a 2D board and a list of words from the dictionary, find all words in the board. Each word mus ...

  9. 3.saltstack的grains和pillar学习笔记

    作者:刘耀 QQ:22102107 SaltStack_Grains Grains grains是minion第一次启动的时候采集的静态数据,可以用在salt的模块和其他组件中.其实grains在每次 ...

  10. 使用iScroll时,input等不能输入内容的解决方法(share)

    最近做移动平台的应用,使用iscroll使屏幕上下滑动.发现当使用iscroll后,input等不能输入内容了.只要在iscroll.js文件中加入如下代码就ok了. function allowFo ...