我一直在思考如何让我的用户使用cPanels XML API更改密码。我用谷歌搜索,使用示例代码,并找不到远程工作的任何东西。有人可以告诉我我做错了什么吗?谢谢!
require_once('../includes/xmlapi.php');
$ip = '127.0.0.1';
$root_pass = 'secret';
$account = 'accountna';
$email_account = $_POST['email'];
$email_domain = "mydomain.com";
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi->set_debug(1);
$args = array(
'domain'=>$email_domain,
'email'=>$email_account
);
if ($xmlapi->api2_query($account, "Email", "passwdpop", array( 'domain' => "domain name", 'email' => "user name", 'password' => "new password") )) {
echo "Success!";
};
答案 0 :(得分:0)
你需要设置端口! 在password_auth之前
$xmlapi->set_port ( 2083 );
$xmlapi->password_auth("root",$root_pass);