How to make PHP perform real-time tasks without updating the page?

Help solve the task: you need to display events (text, numbers or graphs) at a given time interval. A typical solution can be seen in the Rambler, the TV section of the program.

Answer 1, Authority 100%

function xmlHttp(){
    var xmlhttp;
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            xmlhttp = false;
    if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){
        xmlhttp=new XMLHttpRequest();
    return xmlhttp;
function ajax(href, callback, method, data)
    callback = callback || null;
    method = method || 'get';
    data = data || null;
    var x = xmlHttp();
    x.onreadystatechange = function(){
        if(x.readyState == 4 && x.status == 200)
    };, href, true);
    if(method == 'post')
        x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
setTimeout(function(){ajax("news.php", function(text){
    document.getElementById('news').innerHTML = text;
})}, 60*1000);

That’s it like this (the code has not been tested). And News.php must give the ready-made code to insert into the news block, that is, without HTML, Body and other husks.

Answer 2, Authority 50%

For this you need to use Ajax.

I will not explain here (a lot of what you need), just see here
You can also here

Answer 3, Authority 50%

You can also use libraries by type jQuery , they greatly simplify work with AJAX

Answer 4, Authority 50%

Here one RNR cannot do, on the client side you need JavaScript and Ajax to use.

Specific: SETInterval () .

ajax Heap information. It is easiest to use it from a thread framework.