0

What I'm trying to do with this code is retrieve and show the content from an html file whenever something in it changes.

Using a refresh meta doesn't cut it and I've been trying to get this to work right since you can't do a infinite loop with php

<?php
 $url = 'http://someIP/';
?>

<script>
  setTimeout(function() { document.getElementById('loader') }, 12000);
</script>  

<div id="loader">

 <?php
 $LastMod = filemtime($url . "../web/content.html");
    clearstatcache();
  if(($LastMod +60) > time())
  {
     echo file_get_contents($boturl . "../web/content.html");
sleep(10);
  }
?>

</div>
PIndex
  • 1

1 Answers1

0
  1. The javascript doesn't do anything.

  2. filemtime() doesn't support URL's

  3. Not sure what the sleep() is for. Why are you delaying execution after everything's been... executed?

Try using AJAX + setInterval to load a separate script that handles the filemtime part; also, see point 2 - since filemtime won't work on URL's, use cURL

Community
  • 1
  • 1
Alex M
  • 494
  • 5
  • 14