php - Download javascript output using file_get_content -
is possible download resulting html code after javascript code on page has been run using php.
for example, when page has jquery code $("p").html("hello world");
, use file_get_content('website.com')
don't string "hello world" because javascript runs after page load.
use curl:
function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,curlopt_url,$url); curl_setopt($ch,curlopt_returntransfer,1); curl_setopt($ch,curlopt_connecttimeout,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; }
then :
<?php echo get_data('http://theurlhere.com'); ?>
hope helped
Comments
Post a Comment