silverspring Posted January 26, 2015 Share Posted January 26, 2015 Hi, i have 3 active whmcs website and i am developing a package to handle some of our needs. I was trying to get users password with http://docs.whmcs.com/API:Get_Clients_Password But it seems not working; I tried for my first website and it is returns wrongs users password.Checked so many times. I tried for last 2 website and api cant find user at all.( Client ID Not Found ) I tried for both userid and password nothing has changed.I dont want to create custom api function.So any idea? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted January 26, 2015 Share Posted January 26, 2015 Hi, Provide your code and specify if you are using internal or external API 0 Quote Link to comment Share on other sites More sharing options...
silverspring Posted January 27, 2015 Author Share Posted January 27, 2015 Hi @klan Here i am using external api, here is my code but i did try with rest clients like postman too. WHMCS::getClientsPassword(12345) <?php public function getClientsPassword($identity,$params=[]) { is_int($identity) ? ($params['userid']=$identity) : ($params['email']=$identity); $response= $this->getJson('getclientpassword',$params); return !$response ?: $response->body->password; } <?php public function getJson($action,$params=NULL) { $data=[ 'action'=>$action, 'responsetype'=>'json' ]; $data = ($params===NULL) ?: array_merge($data,$params); $response = Request::get($this->dataUrl($data)) ->expectsJson() ->send(); if($response->body->result!='success') { return false; } return $response; } $this->dataUrl simply generates url like https://mywebsite.com/includes/api.php?username=<myusername>&password=<myMd5HashedPass>&action=getclientpassword&userid=12345 0 Quote Link to comment Share on other sites More sharing options...
silverspring Posted January 28, 2015 Author Share Posted January 28, 2015 Finally fixed.It seems getclientpassword diffrent than others.Above example, as you can see i create query string and its a get request userid must be post.Even so it seems a bit buggy.Without posting userid i can get wrong users password. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.