php file_get_contents - javascript执行后 [英] php file_get_contents - AFTER javascript executes

查看:108
本文介绍了php file_get_contents - javascript执行后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我试图用php抓取网页,但是我想在页面上的初始javascript执行后这样做 - 我希望在初始ajax请求之后访问DOM等等...有什么方法可以做到这一点?

解决方案

简答:否。



刮擦网站给出无论服务器响应您所做的HTTP请求(从中导出DOM树的初始状态,如果该内容是HTML)。在Javascript修改DOM后,它无法考虑DOM的当前状态。


basically, I am trying to scrape webpages with php but I want to do so after the initial javascript on a page executes - I want access to the DOM after initial ajax requests, etc... is there any way to do this?

解决方案

Short answer: no.

Scraping a site gives you whatever the server responds with to the HTTP request that you make (from which the "initial" state of the DOM tree is derived, if that content is HTML). It cannot take into account the "current" state of the DOM after it has been modified by Javascript.

这篇关于php file_get_contents - javascript执行后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆