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 7403777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:09:32+00:00 2026-05-29T05:09:32+00:00

i’m building a webpage for livestreamers from my website. but i’m having some problems

  • 0

i’m building a webpage for livestreamers from my website.

but i’m having some problems with it, I have created a table, and i have been screwing around with it a lot and i have had good results, but it isn’t perfect yet, so i’m still stuck

current example http://brokendiamond.org/?q=node/9 ;

i got 2 problems with this;
1 my page loads in about 2 – 3 seconds wich is still a bit too long
2 the data in my table isn’t updating like it is supposed too, when my stream goes live, it doesn’t show in my table, even tho the xml file does get updated, and it doesn’t show the view count correctly, so there is something wrong with that,

Any input about this, or help with this matter would be appreciated, because i realy want to get this part finished, so i can move on on my todo list.

I have heard peoples talk about cashes but i have no clue how to do that so that might be a direction.

the XML API can be found on:
http://api.own3d.tv/liveCheck.php?live_id=210230

and the current code of my webpage is:

Hello and welcome to the Livestream page for the broken diamond community here you can find all our content creator's livestream pages to watch them game. you can chat with other members and even them! We always welcome new followers and will love to hear about suggestions for games, in game tips and all those opinions we know you have to share! Enjoy your favorite streamers, and don't forget their schedule can be found under the information block in the menu.
<div id="livetable">

</div>

<script type="text/javascript">  
load();
var intervalID;  
refresh();
function refresh()  
{  
  intervalID = setInterval(load, 60000);  
}  

function load()  
{  
  var elem = document.getElementById("livetable");
  elem.innerHTML = '<?php loadpage() ?><br>';
}  
</script>

<?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-29T05:09:33+00:00Added an answer on May 29, 2026 at 5:09 am

    The reason it’s not refreshing is because <?php loadpage() ?> will only run when the page starts, not any subsequent refresh (every minute, it looks like). You’d want to make a request to another page to get that content every time after you initially have it.

    jQuery:

    $.get('yoururl.php', function(data) { /* Do stuff with `data` here */ });
    

    As far as speed…What else is going on in that whole page? Between the 3 requests, you’re at ~700ms, which accounts for close to a second of the 2/3, but not quite. I’m assuming there’s some other drupal stuff going on?

    Caching, yes, do that! There are several options you have:
    http://en.wikipedia.org/wiki/List_of_PHP_accelerators / Memcached are the most robust to use. There is another option of saving the response to a file and reading from the file if it’s less than a minute old, otherwise make the request and overwrite it. This would be the simplest and would remove the ~700ms in web requests.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I have a view passing on information from a database: def serve_article(request, id): served_article

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.