Non-browser emulation of JavaScript - is it possible?

前端 未结 8 2288
眼角桃花
眼角桃花 2020-12-17 21:13

I have a new project I am working on that involves fetching a webpage, (using PHP and cURL) parsing the HTML and javascript out of it and then handling the data in the resul

8条回答
  •  半阙折子戏
    2020-12-17 21:56

    Tbh you will have a harder time of just using a JS engine as you also have to create the environment of a browser scripting engine such as the DOM and window objects. If you are running on a Windows server then you could fairly easily use the IE COM objects to load and execute the web page, accessing the DOM programatically and pulling the contents back out. As for your server being Linux and/or Mozilla I unfortunately have no experience.

    But really what are you trying to do?

提交回复
热议问题