Jump to content

Can I so this?


ferret147

Recommended Posts

I have some php in a page which I would like to re-load every 30 seconds, but I don't want to re-load the actual page.

 

Here is the code I wish to re-load

<?php $scores = file_get_contents("http://www.domain.com/text.txt"); 
$p1score = substr("$scores", -33, -30);
$p2score = substr("$scores", -30, -27);
$break = substr("$scores", -27, -24);
$current = substr("$scores", -24, -23);
$p1frames = substr("$scores", -23, -20);
$p2frames = substr("$scores", -20, -17);
$frameNO = substr("$scores", -17, -15);

echo $p1score;
echo $p2score;
echo $break;
echo $current;
echo $p1frames;
echo $p2frames;
echo $frameNO;
?>

 

Is this possible at all? or am I barking up the wrong tree :)

Link to comment
https://forums.phpfreaks.com/topic/148657-can-i-so-this/
Share on other sites

put this php code into it's own file, let's call it subpage.php. then, in your page, put an iframe:

 

<ifram id="subpage" src="subpage.php"></iframe>
<script type="text/javascript">
  var subpage;
  window.onload = function(){
    subpage = document.getElementById('subpage');
    setInterval('subpage.contentWindow.location.reload()',30000); //Refresh every 30 seconds
  }
</script>

Link to comment
https://forums.phpfreaks.com/topic/148657-can-i-so-this/#findComment-780653
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.