Changing Email Passwords With cPanel XML API in PHP -
i've been jogging mind on how enable users change passwords using cpanels xml api. i've googled, played example code, , not find remotely works. can please tell me 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 set port! before password_auth
$xmlapi->set_port ( 2083 ); $xmlapi->password_auth("root",$root_pass);
Comments
Post a Comment