尝试在cPanel中创建帐户时,xmlapi.php不起作用

尝试在cPanel中创建帐户时,xmlapi.php不起作用,php,whm,Php,Whm,我正在尝试在我的WHM中创建一个新帐户临时域。我正在使用从中获取的xmlapi.php api文件 从该Api中,我使用createacct函数。到目前为止,我已经编写了这段代码 require_once("xmlapi.php"); $xmlapi = new xmlapi($ip); $xmlapi->password_auth($user,$pass); $xmlapi->set_debug(1); $acct = array(username => "testdomai

我正在尝试在我的WHM中创建一个新帐户临时域。我正在使用从中获取的xmlapi.php api文件

从该Api中,我使用createacct函数。到目前为止,我已经编写了这段代码

require_once("xmlapi.php");
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth($user,$pass);
$xmlapi->set_debug(1);
$acct = array(username => "testdomain", password => "mSWyae2i", domain => "example.info");
$xml = $xmlapi->createacct($acct);
echo "<pre>";
print_r($xml);
我想我写的代码是正确的,但是API不工作或者没有任何响应。当我运行页面时,页面一直在加载,加载,加载


我能得到一些帮助吗。?还要让我知道在$ip中传递什么???

如果您在要创建新cPanel帐户的同一台服务器上运行PHP脚本,则应将$ip设置为“127.0.0.1”,否则应将其设置为服务器的公共ip地址。您还应该将端口号设置为2087。下面是一个应该有效的示例:

require_once('xmlapi.php');
$xmlapi = new xmlapi('127.0.0.1');
$xmlapi->set_port(2087);
$xmlapi->password_auth('whm_root_username_here', 'whm_root_password_here');
$xmlapi->set_debug(1);
$acct = array('username' => 'desired_cpanel_username_here', 'password' => 'desired_cpanel_password_here', 'domain' => 'example.info');
$xml = $xmlapi->createacct($acct);
echo '<pre>';
print_r($xml);