php - how do I retrieve a remote webpage whose content has been changed using jQuery/javascript? -
i have 2 files here located on separate hosts.
test1.php
<?php $curl = curl_init("http://myhost.com/test2.php?tempvar=testonly"); curl_setopt($curl, curlopt_returntransfer, true); $output = curl_exec($curl); curl_close($curl); echo $output; ?>
test2.php
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ console.log(geturlparameter("tempvar")); //$("#test").html(geturlparameter("tempvar")); function geturlparameter(name) { return (decodeuricomponent((new regexp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search.tolowercase())||[,""])[1].replace(/\+/g, '%20'))).touppercase(); } }); </script> <div id="test"><?php echo $_get['tempvar']; ?> - test</div>
as can seen in test2.php, displaying contents of url variable using php echo function. working works fine.
my problem when use jquery (inside test2.php) change contents of page, curl function not getting updated page content.
any ideas on how fix this? or perhaps workaround?
the pages/code i'm using experiment of sorts. using echo function not problem. the real webpages/code involved includes code page content manipulated via jquery.
i did search net before coming here , found nothing. trying use http_get php function having server issues have reported our server team.
thanks lot.
Comments
Post a Comment