dongyuxiao6295
dongyuxiao6295
2015-06-25 19:41

php curl获取html和js渲染

已采纳

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条回答

  • dowaw80220 dowaw80220 6年前

    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.

    点赞 评论 复制链接分享