ok mira tengo esto ya funcionando pero solo para un xml
Código PHP:
Ver original<?php
$sql = mysql_query("SELECT * FROM settings WHERE id='1'"); if ($line["srv_from"] == "1" ) {
$showuseronline = "1";
} else {
$showuseronline = "0";
}
if ($showuseronline == "1") {
$i = 0;
$srv_ip = $line["srv_ip"];
$srv_port = $line["srv_port"];
$srv_user = $line["srv_user"];
$srv_pass = $line["srv_pass"];
$srv_protocol = $line["srv_protocol"];
$xml = simplexml_load_file($srv_protocol."://".$srv_user.":".$srv_pass."@".$srv_ip.":".$srv_port."/xmlHandler?command=users-1"); $proxyusers = "users-1";
foreach($xml->$proxyusers->user as $users) {
$y = 0;
$activesession = 0;
$userstate = "0";
$xmlusername = "";
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;
$xmlusername = (string)$xml->$proxyusers->user[$i]->attributes()->name;
if ($userstate == "1") {
$userinfo[$xmlusername."-servname"] = @(string)$xml->$proxyusers->user[$i]->session[$activesession]->service->attributes()->name;
} else {
$userinfo[$xmlusername."-servname"] = "";
}
$i++;
}
}