[英]PHP Simple HTML DOM Parser for “Generated Source Code”
From my understanding, there are two types of source code ( Generated Source code
VS Source Code
per page (as describe in here What is the difference between "Source" and "Generated Source"? ). 据我了解,有两种类型的源代码(每页
Generated Source code
与Source Code
(如此处所述) “源”和“生成的源”之间有什么区别? )。
When I use the PHP Simple HTML DOM Parser ( http://simplehtmldom.sourceforge.net/ ), I notice that I could only get the Source Code
. 当我使用PHP简单HTML DOM解析器( http://simplehtmldom.sourceforge.net/ )时,我注意到我只能获得
Source Code
。
How do I get the Generated Source code
? 如何获取
Generated Source code
?
If it is not possible using the PHP Simple HTML DOM Parser , are there other ways using PHP to get the Generated Source code
? 如果无法使用PHP Simple HTML DOM解析器,是否还有其他方法可以使用PHP获取
Generated Source code
? (Optional) (可选的)
If it is not possible using PHP to get the Gebnerated Source code
, are there other ways using javascript to get it? 如果无法使用PHP来获得
Gebnerated Source code
,那么还有其他方法可以使用javascript来获得它吗? (Optional) (可选的)
Updates 1 : With reference to the answer made by user Shankar Damodaran
, I need to change my understanding that there are three types of source code as follows: 更新1 :参考用户
Shankar Damodaran
的回答,我需要改变对以下三种源代码的理解:
Actual Source Code (eg PHP, ASPX. Usually applies to server-side scripts) 实际的源代码(例如PHP,ASPX。通常适用于服务器端脚本)
Source Code (The source code before javascript and css is applied) 源代码(应用javascript和css之前的源代码)
Generated Source Code (the source code after javascript and css is applied) 生成的源代码(应用了javascript和css之后的源代码)
您不能单靠PHP,您必须依靠Selenium或Phantom.js ,它们是无头的浏览器 ,它们将呈现页面并返回您要查找的HTML结构。
Source Code is Interpreted by the server 源代码由服务器解释
Generated Source Code is the one returned to the browser. 生成的源代码是返回到浏览器的代码。 ( Just the HTML stuff )
( 只是HTML的东西 )
What the HTML DOM parser does is that they play with the Generated Source Code and not with the actual Source Code . HTML DOM解析器的作用是它们与“ 生成的源代码”一起播放,而不与实际的源代码一起播放。
How do I get the Generated Source code?
如何获取生成的源代码?
You cannot get the Actual Source Code , unless by illegal means. 除非通过非法手段,否则您无法获得实际源代码 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.