开发者

How to get content on web page include content in javascript like see on browser

i need to get contents on web page and read it via cURL on php,but contents n开发者_运维知识库ot include data on javascript any body can help me to solve this problem ?


Not possibel. A web page with embedded JavaScript is actually a program. CURL gives you the program's source code (HTML and JavaScript), but doesn't run that program. To run a page's embedded JavaScript you need (1) a JavaScript interpreter, and (2) the Document Object Model (DOM) for the page. Browsers have these, but PHP does not. People are working on PHP versions of these, but developing these are big tasks. If this is what you need, you might skip PHP and instead look at writing C++ code using WebKit.


Have you tried file_get_contents?


Yes it is possibe you can do it through a phantomjs browser that loads the page process its javascript and then you can retrieve dynamically rendered content as well. have a look at this link, it may help you.

https://github.com/jonnnnyw/php-phantomjs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜