Experimente isso:
<!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>
E coloque isso em seu process.php
Arquivo:
<?php
include 'simple_html_dom.php';
$html = file_get_html('http://www.time.is/');
foreach($html->find('#clock0') as $element){
echo $element->plaintext;
}
?>
Este é o resultado do meu teste:
- 11:15:43
- 11:15:46
- 11:15:51
- 11:15:53
- 11:15:53
- 11:16:10
- 11:15:52
- 11:15:42
- 11:16:09
- 11:16:17
- 11:16:12
Observação:
1- É aconselhável que você altere intervalos de 1000 milissegundos (1 segundo).
2- Não se esqueça de usar clearInterval()
Após repetição específica.