php curl get html and js render

≡放荡痞女 提交于 2021-02-05 11:57:19

问题


php curl only get the source code of a html page without executing the js script. I need for my website to get the source code with all the javascript already executed. I use ajax and I can't add more js in the page because script stay when I load another page. I find spiderMonkey but it can't fix my problem.

Is there something in php which do that ?

Thank you


回答1:


No you can't. Not from PHP directly.

If you have control over the server you could install phantomjs and have it execute the code since it basically provides you with a headless browser that can do what you want.



来源:https://stackoverflow.com/questions/31059393/php-curl-get-html-and-js-render

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!