As a title, my question is how to output (say, save as a text file on the server or pass the result of some other php function using ajax) all the contents of the DOM on the page?
I did some homework, I tried curl, it can just output all the contents of the DOM using "curl http://google.ca > dom.txt" However, this approach will not save the content generated by Javascript, in other words, javascript code will not work . Another approach is to insert javascript code into the page and allow the page to be uploaded to the website we want to display, and then use javascript code to save the entire DOM file after loading.
I'm not sure if phantom.js can do such a task, if so, how?
Can any body give a detailed answer on how to achieve this?
I am open to any solutions, this program will run on my server to provide the service.
Thanks in advance.
cache source
share