progere Posted April 2, 2014 Share Posted April 2, 2014 Hello, I'm trying to write my own provision module for a service I have, but I have doubts about how do I "talk" to whmcs... For example, I have the following working code: function template_ChangePassword($params) { # Code to perform action goes here... $instance = $username; # PS: check var to use in this, username does not seem right $directory = dirname(__FILE__); ob_start(); passthru('/usr/bin/env python3 '.$directory.'/mailcloud.py unsuspendinstance '.$instance); $resultData = json_decode(ob_get_clean(), true); if ($resultData['status'] == "ok") { $successful = 1; } if ($successful) { $result = "success"; } else { $result = $resultData['ERROR']; } return $result; } How do I make WHMCS retrieve my password and update its DB? Do i use internal API? Like this?: function template_ChangePassword($params) { # Code to perform action goes here... $instance = $username; # PS: check var to use in this, username does not seem right $directory = dirname(__FILE__); ob_start(); passthru('/usr/bin/env python3 '.$directory.'/mailcloud.py unsuspendinstance '.$instance); $resultData = json_decode(ob_get_clean(), true); if ($resultData['status'] == "ok") { # WHMCS Internal API $command = "modulechangepw"; $adminuser = "admin"; $values["serviceid"] = $serviceid; $values["servicepassword"] = $resultData['password']; # Execute command $result = localAPI($command,$values,$adminuser); } } I'm using ModuleDevKit and read the Provisioning_Module_Developer_Docs, but I think if there were some module examples it would be easier to understand how it works... Thanks in advance. 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.