Fetch javascript generated html with PHP


I am trying to fetch a page source. The page source generated with Javascript. FOR EXAMPle :

document.write(“<div>SAMPLE TEXT</div>”);

When i see the html source with firefox firebug. It shows div in the body tag however by viewing the source code by View->Page source it just shows the javascript code.

To fetch the page i am using simplehtmldom parsar however it is not working it is also fetching javascript code.

Please help me to suggest any other alternative or suggestion about this.


I don’t understand your question

Adding HTML from JavaScript using document.write does not update the DOM. You need to use the correct JavaScript DOM commands to update the page if you want the DOM to be updated as well as what displays on the page.

I think he’s after something different from that.

What I believe he wants, is to be able to use PHP to retrieve the contents of a web page, after that web page has processed and rendered its scripting.

Yes, i would like to fetch the html code already generated by Javascript. Is there any script or method to achieve this in php?

I don’t think that you can.