php - Download webpages with javascript dynamic content -


i have php script download webpages. problem downloaded files haven't got dynamic content written javascript.

i suppose need javascript engine or similar. there php library or command-line program downloading webpage dynamic content?

example of need: want download webpage www.example.com/product.html.

now: i'm able download code:

<h1></h1> 

what want: want download code:

<h1>title written javascript</h1> 

this happening because javascript not downloaded properly. downloading html file , not attached javascript files.

once javascript available html page, dynamic content coming correctly.

another workaround: can use selenium web automation libraries opens page in browser, let browser execute js , prepare dom. after can download html content.

one more:

you can make use of phantomjs download html page, process javascript , give final output save.

https://superuser.com/questions/448514/command-line-browser-with-js-support