Jump to content

UpdateClient and AddClient API Do Not work


DaveK

Recommended Posts

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.

Edited by DaveK
identifyable info
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated