简体   繁体   English

在PHP中使用cPanel XML API更改电子邮件密码

[英]Changing Email Passwords With cPanel XML API in PHP

I've been jogging my mind on how to enable my users to change their passwords using the cPanels XML API. 我一直在慢跑着想如何让我的用户使用cPanels XML API更改密码。 I've googled, played with example code, and could not find anything that remotely works. 我已经用谷歌搜索过,玩过示例代码,却找不到任何可以远程工作的东西。 Can someone please tell me what I'm doing wrong? 有人可以告诉我我在做什么错吗? Thanks! 谢谢!

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!";
};

you neet to set port! 您要设置端口了! before password_auth 在password_auth之前

$xmlapi->set_port ( 2083 );
$xmlapi->password_auth("root",$root_pass);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM