Este es el código que ya tengo funcionando
Código PHP:
Ver original
<?php $showuseronline = $line["fetchfromcsp"]; if ($showuseronline == "1") { $i = 0; $cspsrv_ip = $line["cspsrv_ip"]; $cspsrv_port = $line["cspsrv_port"]; $cspsrv_user = $line["cspsrv_user"]; $cspsrv_pass = $line["cspsrv_pass"]; $cspsrv_protocol = $line["cspsrv_protocol"]; $xml = simplexml_load_file($cspsrv_protocol."://".$cspsrv_user.":".$cspsrv_pass."@".$cspsrv_ip.":".$cspsrv_port."/xmlHandler?command=proxy-users"); $proxyusers = "proxy-users"; $servicename = "service-name"; foreach($xml->$proxyusers->user as $users) { $y = 0; $activesession = 0; $userstate = "0"; foreach($xml->$proxyusers->user[$i]->session as $active) { if ((string)$xml->$proxyusers->user[$i]->session[$y]->attributes()->active == "true") { $userstate = "1"; $activesession = $y; } $y++; } $activeusers[] = (string)$xml->$proxyusers->user[$i]->attributes()->name; $activeusersstate[(string)$xml->$proxyusers->user[$i]->attributes()->name] = $userstate; $userinfo[(string)$xml->$proxyusers->user[$i]->attributes()->name."-host"] = (string)$xml->$proxyusers->user[$i]->session[$activesession]->attributes()->host; $userinfo[(string)$xml->$proxyusers->user[$i]->attributes()->name."-duration"] = (string)$xml->$proxyusers->user[$i]->session[$activesession]->attributes()->duration; $userinfo[(string)$xml->$proxyusers->user[$i]->attributes()->name."-name"] = (string)$xml->$proxyusers->user[$i]->session[$activesession]->attributes()->name; $i++; } } ?>
Este es para hacer un print
Código PHP:
Ver original
<?php if( $listado ){ } print("<td width=\"35\">".$userinfo[$row["usuario"]."-host"]."</td>"); print("<td width=\"35\">".$userinfo[$row["usuario"]."-duration"]."</td>"); print("<td width=\"70\">".$userinfo[$row["usuario"]."-name"]."</td>"); } ?>
Y este es el xml que estoy usando para llamar la informacion
