Please can someone help me? I'm using the WHM API to list the users, these users searching the area, but I can not make it work. I have tried, but not work. how to search the User by the domain???
example:
$domain = 'mydomain.com';
$accounts = $whm->listaccts($domain);
foreach ($accounts as $ac){
$userCp = $ac["user"];
}
echo $userCp;
Function:
function listaccts()
{
//connect using prpoer xml api address
$this->connect('/xml-api/listaccts');
//get the output
$xmlstr=$this->getOutput();
if($xmlstr=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
$xml = new DOMDocument();
$xml->loadXML($xmlstr);
// statement block to get the elements of the xml document
$list = $xml->getElementsByTagName('user');
$i=0;
foreach ($list AS $element)
{
foreach ($element->childNodes AS $item)
{
$result[$i]['user']=$item->nodeValue;
$i++;
}
}
$list = $xml->getElementsByTagName('domain');
$i=0;
foreach ($list AS $element)
{
foreach ($element->childNodes AS $item)
{
$result[$i]['domain']=$item->nodeValue;
$i++;
}
}
$list = $xml->getElementsByTagName('plan');
$i=0;
foreach ($list AS $element)
{
foreach ($element->childNodes AS $item)
{
$result[$i]['package']=$item->nodeValue;
$i++;
}
}
$list = $xml->getElementsByTagName('unix_startdate');
$i=0;
foreach ($list AS $element)
{
foreach ($element->childNodes AS $item)
{
$result[$i]['start_date']=$item->nodeValue;
$i++;
}
}
//return the result array
return $result;
}
I've tried several ways, but does not work. Thank you so much for your attention
Renata