public function makeWhm2($host, $port, $passwd) { load_lib("pub:whm"); $whm = new WhmClient(); $whmUrl = "http://" . $host . ":" . $port . "/"; $whm->setUrl($whmUrl); $whm->setSecurityKey($passwd); return $whm; }
protected function refreshHostTemplete($node) { daocall('vhosttemplete', 'updateNodeState', array($node['name'])); $whm = new WhmClient(); $whm->setAuth($node['user'], $node['passwd']); $whm->setWhmUrl("http://" . $node['host'] . ":" . $node['port'] . "/core.whm"); $call = new WhmCall("list_tvh"); $result = $whm->call($call); if (!$result) { die('failed'); return false; } $templete = array(); for ($i = 0;; $i++) { $value = $result->get("name", $i); if (!$value) { break; } $templete[] = $value; //echo "tvh=".$value."\n"; } daocall('vhosttemplete', 'updateNodeTemplete', array($node['name'], $templete)); //die('success'); }