Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7400321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:13:55+00:00 2026-05-29T04:13:55+00:00

Is there a way to make a certain div autorefresh every minute or so,

  • 0

Is there a way to make a certain div autorefresh every minute or so, and not my whole page? Because it would take too long to reload the page every minute. The div itself is the important part which can change.

<div id="livetable">
<?php loadpage(); ?>
</div>

<?php
define('ELEMENT_CONTENT_ONLY', true);
define('ELEMENT_PRESERVE_TAGS', false);

function value_in($element_name, $xml, $content_only = true) 
{
    if ($xml == false)
    {
        return false;
    }
    $found = preg_match('#<'.$element_name.'(?:\s+[^>]+)?>(.*?)'.'</'.$element_name.'>#s', $xml, $matches);
    if ($found != false) 
    {
        if ($content_only) 
        {
            return $matches[1];  //ignore the enclosing tags
        }
       else 
       {
            return $matches[0];  //return the full pattern match
        }
    }
    // No match found: return false.
    return false;
}

function loadpage()
{
      echo "<table cellpadding=\"0\" cellspacing=\"0\" style=\"width: 95%\" >";
      echo "<tr class=\"info-row\" bgcolor=#252525 style=\"color:white;  height: 15px;\">";
      echo "<td style=\"width: 14%; height: 10px; padding-left: 5px;\"><b>Preview</b></td>";
      echo "<td style=\"width: 10%; height: 10px; padding-left: 5px;\"><b>Live</b></td>";
      echo "<td style=\"width: 36%; height: 10px; padding-left: 5px;\"><b>Stream</b></td>";
      echo "<td style=\"width: 10%; height: 10px; padding-left: 5px;\"><b>Viewers</b></td>";
      echo "<td style=\"width: 10%; height: 10px; padding-left: 5px;\"><b>Time online</b></td>";
      echo "</tr>";
      addrow(107473,10,"Osuryn","Osuryn is streaming random games live",false);
      addrow(210320,28,"Dennojj","Dennojj is streaming PS3 games",true);
      echo "</table>";
}

function addrow($streamID, $streamPage , $streamName , $streamSlogan, $odd)
{
     if ($odd)
     {
            echo "<tr class=\"content-row online\" id=\"958\" bgcolor=#A7A7A7>";
     }
     else
     {
            echo "<tr class=\"content-row online\" id=\"958\" bgcolor=#BFBFBF>";
     }
     echo "<td style=\"width: 14%;\"><img src=\"http://img.hw.own3d.tv/live/live_tn_".$streamID."_.jpg\" style=\"height: 72px;\" \></td>";
     echo "<td style=\"width: 10%; padding-left: 5px;\"><br><br><b>".getLiveStatus($streamID)."</b></td>";
     echo "<td style=\"width: 36%; vertical-align: top; padding-top: 6px; padding-right: 6px;\">";
     echo "<div><br><a href=\"http://brokendiamond.org/?q=node/$streamPage\">$streamName</a></div>";
     echo "<div style=\"padding-top: 6px; font-size: 11px;\">$streamSlogan</div>";
     echo "</td>";
     echo "<td style=\"width: 10%; padding-left: 5px;\"><br><br>".getLiveViews($streamID)."</td>";
     echo "<td style=\"width: 10%; padding-left: 5px;\"><br><br>".getOnTime($streamID)." minutes online</td>";
     echo "</tr>";
}

function getLiveStatus($streamID)
{
    $request =  'http://api.own3d.tv/liveCheck.php?live_id='.$streamID;
    $arg = '240';

    $session = curl_init($request.$arg);

    curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($session);
    curl_close($session);

    if (preg_match("/true/",$response, $result)) 
    {
        $streamStatus="Live";
    } 
    else 
    {
      $streamStatus="Offline";
    }
    return $streamStatus;
}

function getLiveViews($StreamID)
{
    $request =  'http://api.own3d.tv/liveCheck.php?live_id='.$StreamID;
    $arg = '240';

    $session = curl_init($request.$arg);

    curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($session);
    curl_close($session);

    $viewStatus =value_in('liveViewers', $response) + "";

    return $viewStatus;
}

function getOnTime($StreamID)
{
    $request =  'http://api.own3d.tv/liveCheck.php?live_id='.$StreamID;
    $arg = '240';

    $session = curl_init($request.$arg);

    curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($session);
    curl_close($session);

    $onStatus =value_in('LiveDuration', $response) + "";

    return $onStatus;
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:13:56+00:00Added an answer on May 29, 2026 at 4:13 am

    You’ll need to make AJAX request with JavaScript that’ll update the div or use an iframe.

    The simplest way to do this or maybe if you’re not familiar with JavaScript, is to use an iframe. Basically what you need to do is have the content of the div loaded using the iframe and also modify the PHP code that’s used within the iframe to reload the page after X seconds. This should be easy with PHP header() function.

    If you’re going to go with AJAX instead, you’ll want to use the setInterval() function to repeat a function call that will actually make the AJAX request and update the div‘s content. However, it might be a good idea to use setTimeout() instead and have the function call itself, by also using setTimeout() too of course after X seconds. The reason for that is because, by using setInterval() JavaScript will continues to run even if the last operation has not yet finished. But if you were to use setTimeout() JavaScript will wait for the last function call to finish before moving on to the next one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to make a certain page work as a cookieless session?
Is there a way to make Windows Mobile not use the main phone app?
In a winforms tabcontrol, is there a way to make a certain tab visible
Is there some way to make boost::python control the Python GIL for every interaction
Is there any way to make certain dates in a DateTimePicker look more prominent
Or: Is there a standard way to create subclass but make certain methods from
Is there a way to make certain event actions specific to left and right
Is there a way to make a click-to-edit control in silverlight? I've got some
Is there a way to make this code work? LogonControl.java @Audit(AuditType.LOGON) public void login(String
Is there a way to make a java.awt.Font strike through?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.