Here's the situation. I need to fetch a page and execute the javascript.. then process the page in PHP. That javascript dynamically modifies the HTML of the page. Here's what I'm thinking of doing.
ob_start
and ob_get_clean
to fetch the modified content. Code:
$contents = file_get_contents('http://...');
ob_start();
echo $contents;
$output = ob_get_clean();
Is there a way to achieve what I am attempting to do? I know javascript usually executes after page has loaded (and PHP is long gone).
带有.ajax()
jQuery
或带有纯JavaScript
的XMLHttpRequest
对象。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.