douyin7829 2017-01-25 16:06
浏览 26

PHP - 如何使用JavaScript动态内容解析来自站点的数据

I am trying parse data from this site: www.sberbank.ua/branches/, and I am using simple HTML DOM Parser.

I tried this:

include_once(dirname(__FILE__).'/simple_html_dom.php');
$html = file_get_html('http://www.sberbank.ua/branches/');
foreach($html->find("div.bitem") as $e) {
    echo $e->innertext."<br>";
}

This is the data that I need parse: screenshot

The problem is that the data is generated by javascript and when I tried get the DIV this was empty.

Please someone can help me to solve this?

  • 写回答

1条回答 默认 最新

  • dtwk6019 2017-01-25 22:58
    关注

    I solved this using Firebug extension for Firefox, with this I found the URL that the JS function uses to get the data. Finally I parsed the data from the new URL.

    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序