I tried to set the passwords during as mass imports using the addClient function to no luck. I have as a result attempted to use the following code to try and update a client's password. It returns success, but any password I put in it, whether it be a text string or a variable does NOT work. Assume the url, username, and clientid and password to be correct, as it connects and states that it was successful in the $results["result"] variable.
<?
$url = ""; # URL to WHMCS API file
$username = ""; # Admin username goes here
$password = ""; # Admin password goes here
$postfields["username"] = $username;
$postfields["password"] = md5($password);
$postfields["action"] = "updateclient";
$postfields["clientid"] = "";
$postfields["password2"] = "demo1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$data = explode(";",$data);
print_r ($data);
foreach ($data AS $temp) {
$temp = explode("=",$temp);
$results[$temp[0]] = $temp[1];
}
if ($results["result"]=="success") {
# Result was OK!
print "Account Updated";
} else { echo 'error!'.$results["result"];}
?>
so after the update, the password should be demo1, correct? Not the case.