jae-jae / QueryList

:spider: The progressive PHP crawler framework! 优雅的渐进式PHP采集框架。
https://querylist.cc
2.66k stars 441 forks source link

使用phantomjs无法获取js动态数据 #96

Closed ZTzha closed 4 years ago

ZTzha commented 4 years ago

测试URL:https://www.sojson.com/beian/9OoOT92yUuhzPfMy.html

代码:$data = $ql->browser(function (\JonnyW\PhantomJs\Http\RequestInterface $r){ $r->setMethod('GET'); $r->setUrl('https://www.sojson.com/beian/9OoOT92yUuhzPfMy.html'); $r->setTimeout(10000); // 10 seconds $r->setDelay(3); // 3 seconds return $r; })->find('tbody')->texts(); print_r($data->all());

结果:Array ( [0] => 网站名称 百度 主办单位名称 北京百度网讯科技有限公司 主办单位性质 加载中... ICP备案号/许可证号 京ICP证 号- 网站首页地址 www.baidu.com 审核时间 ....省略 )

获取结果为 加载中.... 增加setdelay都一样

jae-jae commented 4 years ago

phantomjs 原项目已经很久不再维护了,建议使用 Puppeteer 插件代替