let's say that on some site there are some div elements, which content is generated by javascript. I want to code a PHP s开发者_开发问答cript, that will get that content and store it to some variable. I know how to parse text using PHP, I just don't know how to get to the javascript generated output (not JavaScript code!) and store it to PHP variable. Any ideas?
You could post the HTML back to your PHP script. Assuming that the javascript code fills out an element with id="foo"
...
var generatedHTML = document.getElementById('foo').innerHTML;
Then you could use whatever AJAX library you might have (eg: jQuery) to post it to a server for processing.
(Or you could process it on the client side..!)
精彩评论