Prueba esto:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
function timer(){
$.post( "process.php", function( data ) {
$('#times').append('<li>'+data+'</li>');
});
}
setInterval(function(){timer()},1000);
});
</script>
</head>
<body>
<ul id="times"></ul>
</body>
</html>
Y pon esto en tu process.php
archivo:
<?php
include 'simple_html_dom.php';
$html = file_get_html('http://www.time.is/');
foreach($html->find('#clock0') as $element){
echo $element->plaintext;
}
?>
Este es el resultado de mi prueba:
- 11:15:43 a.m.
- 11:15:46 a.m.
- 11:15:51 a.m.
- 11:15:53 a.m.
- 11:15:53 a.m.
- 11:16:10 a.m.
- 11:15:52 a.m.
- 11:15:42 a.m.
- 11:16:09 a.m.
- 11:16:17 a.m.
- 11:16:12 a.m.
Nota:
1- Es recomendable que cambies los intervalos a partir de 1000 milisegundos (1 segundo).
2- No olvides usar clearInterval()
después de una repetición específica.