Jump to content

Virtualmin API call


serveria

Recommended Posts

Hi,

We're trying to create a module which would provision email accounts on a Virtualmin server (don't ask why it was requested by a customer). What we have so far is a sample WHMCS provisioning module from github and Virtualmin API documentation. We know the command which needs to be executed on a Vmin server it would be similar to this one: 

  https://yourserver:10000/virtual-server/remote.cgi?program=create-user

But how can we call this command from WHMCS? It should be somewhere around this place here:

function provisioningmodule_CreateAccount(array $params)
{
    try {
        // Call the service's provisioning function, using the values provided
        // by WHMCS in `$params`.
        //
        // A sample `$params` array may be defined as:
        //
        // ```
        // array(
        //     'domain' => 'The domain of the service to provision',
        //     'username' => 'The username to access the new service',
        //     'password' => 'The password to access the new service',
        //     'configoption1' => 'The amount of disk space to provision',
        //     'configoption2' => 'The new services secret key',
        //     'configoption3' => 'Whether or not to enable FTP',
        //     ...
        // )
        // ```
    } catch (Exception $e) {
        // Record the error in WHMCS's module log.
        logModuleCall(
            'provisioningmodule',
            __FUNCTION__,
            $params,
            $e->getMessage(),
            $e->getTraceAsString()
        );

Please assist, any help will be appreciated...

Link to comment
Share on other sites

Hi,

Tried this so far:

function provisioningmodule_CreateAccount(array $params)
{
    try {
        
        $result = shell_exec("wget -O - --quiet --http-user=root --http-passwd=xxxxxx --no-check-certificate 'https://xx.xx.xx.xx:10000/virtual-server/remote.cgi?program=create-user --domain example.com --user jimmy --pass smeg --quota 1024'");

    }

but no go...

WHMCS is giving me this error:

Module Create Failed - Service ID: xxx - Error: Function Not Supported by Module

Any suggestions? What are we doing wrong?

Edited by serveria
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