Is it possible to get the content of a URL with PHP (using some sort of function like file_get_contents
or header
) but only after the execution of some JavaScript code?
Example:
mysite.com has a script that does loadUrlAfterJavascriptExec('http://exampletogetcontent.com/')
and prints/echoes the content. imagine that some jQuery runs on http://exampletogetcontent.com/
that changes DOM, and loadUrlAfterJavascriptExec
will get the resulting HTML
Can we do that?
Just to be clear, what I want is to get the content of a page through a URL, but only after JavaScript runs on the target page (the one PHP is getting its content).
I am aware PHP runs before the page is sent to the client, and JS only after that, but thought that maybe there was an expert workaround.