Jump to content

Table + Array trouble Part2


Iosys

Recommended Posts

I'm trying to get stream to show if online or offline, the check.php works just fine if i don't have "$f3" in line 5 but I need to collect from array and put into there.

Usually the array works just fine but this time it's not :(

 

Well anyway the error I'm getting is

Warning: DOMDocument::load() [domdocument.load]: Couldn't resolve host name in /home/dahdop/public_html/pvpstreams.com/table/check.php on line 5

Warning: DOMDocument::load(http://x.api.channel.livestream.com/2.0/livestatus.xml) [domdocument.load]: failed to open stream: operation failed in /home/dahdop/public_html/pvpstreams.com/table/check.php on line 5

Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "http://x.api.channel.livestream.com/2.0/livestatus.xml" in /home/dahdop/public_html/pvpstreams.com/table/check.php on line 5
Offline | Viewers: 

 

To me its taking away an "x" and making the array blank for some reason.

 

My site is pvpstreams.com if you want to see error in action.

 

My table.php file

<script language="javascript">

imageX1='plus';
imageX2='plus';
imageX3='plus';

function toggleDisplay(e){
imgX="imagePM"+e;
tableX="table"+e;
imageX="imageX"+e;
tableLink="tableHref"+e;
imageXval=eval("imageX"+e);
element = document.getElementById(tableX).style;
if (element.display=='none') {element.display='block';}
else {element.display='none';}
if (imageXval=='plus') {document.getElementById(imgX).src='http://www.pvpstreams.com/icons/wowicon.png';eval("imageX"+e+"='minus';");document.getElementById(tableLink).title='Hide WoW';}
else {document.getElementById(imgX).src='http://www.pvpstreams.com/icons/wowicon.png';eval("imageX"+e+"='plus';");document.getElementById(tableLink).title='Show WoW';}
}
</script>

<?php
$username="x";
$password="x";
$tmp="x";

mysql_connect(localhost,$username,$password);
@mysql_select_db($tmp) or die( "Unable to select database");
$query="SELECT * FROM users";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>
<table class="sortable" id="wow" border="1" cellpadding="0" cellspacing="0" style="margin-left:auto;margin-right:auto;text-align:left">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Character</font></th>
<th><font face="Arial, Helvetica, sans-serif">Xfire</font></th>
<th><font face="Arial, Helvetica, sans-serif">Livestream</font></th>
<th><font face="Arial, Helvetica, sans-serif">Livestream Status</font></th>
<th><font face="Arial, Helvetica, sans-serif">Team Members</font></th>
<th><font face="Arial, Helvetica, sans-serif">Realm</font></th>
</tr>

<?php
$i=0;
while ($i < $num) {

$f1=mysql_result($result,$i,"wowcharacter");
$f2=mysql_result($result,$i,"username");
$f3=mysql_result($result,$i,"livestream");
$f4=mysql_result($result,$i,"wowserver");

$f5=mysql_result($result,$i,"wowplayer1");
$f6=mysql_result($result,$i,"wowplayer2");
$f9=mysql_result($result,$i,"wowplayer3");

$f7=mysql_result($result,$i,"wowrealm");
$f8=mysql_result($result,$i,"xfire");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><?php Echo "<a class=blue href=http://$f9.battle.net/wow/en/character/$f7/$f1/simple>$f1</a>"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php Echo "<a class=blue href=http://www.pvpstreams.com/xfire.php?user=$f2>$f8</a>"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "<a class=blue href=http://www.pvpstreams.com/livestream.php?user=$f2>$f3</a>"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif">





<?php include("check.php"); ?>






</font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "<img src=wclassicons/$f5.png><img src=wclassicons/$f6.png><img src=wclassicons/$f9.png>" ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f7; ?></font></td>
</tr>


<?php
$i++;
}
?>
</table>

 

My check.php file

<?php

$objDOM = new DOMDocument();
// channel name here **INSERT**
$objDOM->load("http://x$f3x.api.channel.livestream.com/2.0/livestatus.xml"); 

//make sure path is correct
$channel = $objDOM->getElementsByTagName("channel");  
foreach( $channel as $value )
  {
        $isLives = $value->getElementsByTagName("isLive");
$isLive  = $isLives->item(0)->nodeValue;
$viewers = $value->getElementsByTagName("currentViewerCount");
$viewer  = $viewers->item(0)->nodeValue;
  }
  
if($isLive == "true")
{
	echo "<font color='#00FF00'>Online</font>";
	echo " |   Viewers: " . $viewer;
}
else
{
	echo "<font color='#FF0000'>Offline</font>";
	echo " |   Viewers: " . $viewer;
}
?>

 

 

Any help appreciated!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.