Search code examples
phphtmlbrowsercapturegenerated

How to capture HTML generated by browser with PHP?


I need to parse a webpage that is generated by JavaScript. So, I need to know if there is a way of capture the HTML generated by a browser with PHP.

I have seen examples of capturing the print screen of a wep page generated by the browser. It is possible to capture the HTML?

Best Regards,


Solution

  • you can't capture it since javascript is processed by the client browser, not the server,

    a way to do what you want can be to insert javascript code in page to send the entire html to the server:

    if you use jquery you can do it with something like this:

    var htmlCode = $("body").html();
    $.post("recorder.php", { html: htmlCode } );