1

我一直在思考如何让我的用户使用 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!";
};
4

1 回答 1

0

你需要设置端口!在 password_auth 之前

$xmlapi->set_port ( 2083 );
$xmlapi->password_auth("root",$root_pass);
于 2014-03-07T15:09:48.187 回答