V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Sunrise837
V2EX  ›  PHP

问个利用 PHP 采集脚本取值问题。。。

  •  
  •   Sunrise837 · Jun 8, 2018 · 2612 views
    This topic created in 2880 days ago, the information mentioned may be changed or developed.

    想抓取一个网站的某些数据,网页上显示正常数据如下:

    数据-1:111 112 113 数据-2:222 223 224

    查看网页源代码,却找不到数据源,网页代码显示如下:

    数据-1: <label id="data-1"></label>
    <label id="data-1"></label> <label id="data-1"></label>    数据-2: <label id="data-2"></label> <label id="data-2"></label> <label id="data-2"></label>

    问一下这个值该怎么获取?

    10 replies    2018-06-08 17:13:47 +08:00
    killerv
        1
    killerv  
       Jun 8, 2018
    js 渲染出来的吧
    ben1024
        2
    ben1024  
       Jun 8, 2018
    >PHPQuery
    >symfony/dom-crawler
    >symfony/css-selector
    VgV
        3
    VgV  
       Jun 8, 2018
    这种格式好像菠菜。。。。
    fcten
        4
    fcten  
       Jun 8, 2018
    直接爬取 api 接口。
    zsdroid
        5
    zsdroid  
       Jun 8, 2018
    strip_tags
    Sunrise837
        6
    Sunrise837  
    OP
       Jun 8, 2018
    @VgV 老铁啥意思?
    Sunrise837
        7
    Sunrise837  
    OP
       Jun 8, 2018
    @killerv 不是 ajax 加载吗
    han8gui
        8
    han8gui  
       Jun 8, 2018
    你这个说的不怎么清楚
    常见方案:phantomjs 获取 js 执行后的代码,再用 phpquery 解析 DOM
    atonganan
        9
    atonganan  
       Jun 8, 2018
    菠菜 -->bc -->菲律宾
    Sunrise837
        10
    Sunrise837  
    OP
       Jun 8, 2018
    @han8gui 谢谢老铁
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2963 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 15:25 · PVG 23:25 · LAX 08:25 · JFK 11:25
    ♥ Do have faith in what you're doing.