Note that there are some explanatory texts on larger screens.

plurals
  1. POLivestream table isn't updating like it is supposed to
    primarykey
    data
    text
    <p>i'm building a webpage for livestreamers from my website.</p> <p>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</p> <p>current example <a href="http://brokendiamond.org/?q=node/9" rel="nofollow">http://brokendiamond.org/?q=node/9</a> ;</p> <p>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,</p> <p>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.</p> <p>I have heard peoples talk about cashes but i have no clue how to do that so that might be a direction.</p> <p>the XML API can be found on: <a href="http://api.own3d.tv/liveCheck.php?live_id=210230" rel="nofollow">http://api.own3d.tv/liveCheck.php?live_id=210230</a></p> <p>and the current code of my webpage is:</p> <pre><code>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. &lt;div id="livetable"&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; load(); var intervalID; refresh(); function refresh() { intervalID = setInterval(load, 60000); } function load() { var elem = document.getElementById("livetable"); elem.innerHTML = '&lt;?php loadpage() ?&gt;&lt;br&gt;'; } &lt;/script&gt; &lt;?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('#&lt;'.$element_name.'(?:\s+[^&gt;]+)?&gt;(.*?)'.'&lt;/'.$element_name.'&gt;#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 "&lt;table cellpadding=\"0\" cellspacing=\"0\" style=\"width: 95%\" &gt;"; echo "&lt;tr class=\"info-row\" bgcolor=#252525 style=\"color:white; height: 15px;\"&gt;"; echo "&lt;td style=\"width: 14%; height: 10px; padding-left: 5px;\"&gt;&lt;b&gt;Preview&lt;/b&gt;&lt;/td&gt;"; echo "&lt;td style=\"width: 10%; height: 10px; padding-left: 5px;\"&gt;&lt;b&gt;Live&lt;/b&gt;&lt;/td&gt;"; echo "&lt;td style=\"width: 36%; height: 10px; padding-left: 5px;\"&gt;&lt;b&gt;Stream&lt;/b&gt;&lt;/td&gt;"; echo "&lt;td style=\"width: 10%; height: 10px; padding-left: 5px;\"&gt;&lt;b&gt;Viewers&lt;/b&gt;&lt;/td&gt;"; echo "&lt;td style=\"width: 10%; height: 10px; padding-left: 5px;\"&gt;&lt;b&gt;Time online&lt;/b&gt;&lt;/td&gt;"; echo "&lt;/tr&gt;"; addrow(107473,10,"Osuryn","Osuryn is streaming random games live",false); addrow(210320,28,"Dennojj","Dennojj is streaming PS3 games",true); echo "&lt;/table&gt;"; } function addrow($streamID, $streamPage , $streamName , $streamSlogan, $odd) { if ($odd) { echo "&lt;tr class=\"content-row online\" id=\"958\" bgcolor=#A7A7A7&gt;"; } else { echo "&lt;tr class=\"content-row online\" id=\"958\" bgcolor=#BFBFBF&gt;"; } echo "&lt;td style=\"width: 14%;\"&gt;&lt;img src=\"http://img.hw.own3d.tv/live/live_tn_".$streamID."_.jpg\" style=\"height: 72px;\" \&gt;&lt;/td&gt;"; echo "&lt;td style=\"width: 10%; padding-left: 5px;\"&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;".getLiveStatus($streamID)."&lt;/b&gt;&lt;/td&gt;"; echo "&lt;td style=\"width: 36%; vertical-align: top; padding-top: 6px; padding-right: 6px;\"&gt;"; echo "&lt;div&gt;&lt;br&gt;&lt;a href=\"http://brokendiamond.org/?q=node/$streamPage\"&gt;$streamName&lt;/a&gt;&lt;/div&gt;"; echo "&lt;div style=\"padding-top: 6px; font-size: 11px;\"&gt;$streamSlogan&lt;/div&gt;"; echo "&lt;/td&gt;"; echo "&lt;td style=\"width: 10%; padding-left: 5px;\"&gt;&lt;br&gt;&lt;br&gt;".getLiveViews($streamID)."&lt;/td&gt;"; echo "&lt;td style=\"width: 10%; padding-left: 5px;\"&gt;&lt;br&gt;&lt;br&gt;".getOnTime($streamID)." minutes online&lt;/td&gt;"; echo "&lt;/tr&gt;"; } 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; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload