请问有人可以帮我吗?我正在使用 WHM API 列出用户,这些用户正在搜索该区域,但我无法使其工作。我试过了,但没有用。如何按域搜索用户???
例子:
$domain = 'mydomain.com';
$accounts = $whm->listaccts($domain);
foreach ($accounts as $ac){
$userCp = $ac["user"];
}
echo $userCp;
功能:
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;
}
我尝试了几种方法,但都不起作用。非常感谢您的关注
雷娜塔