Dev License: This installation of WHMCS is running under a Development License and is not authorized to be used for production use. Please report any cases of abuse to abuse@whmcs.com

HOW TO CALL A FUNCTION USING VOIP.MS SOAP API Print

  • 0

The following samples show how to get all Servers Information from our database and how to select a specific Server for your display purposes.

We provide a complete VoIPms Class with all functions on our Example Files

PHP5 - Class VoIPms - Sample Code

<?
class VoIPms{
    /*******************************************\
     *  VoIPms - API Credentials
    \*******************************************/
    var $api_username   = 'john.doe@mydomain.com';
    var $api_password   = 'johnspassword';



    /*******************************************\
     *  VoIPms - SoapClient / SoapCall
    \*******************************************/
    var $soap_client;
    function soapClient(){
        $this->soap_client = new SoapClient(null, array(
                'location'      => "https://voip.ms/api/v1/server.php",
                'uri'           => "urn://voip.ms",
                'soap_version'  => SOAP_1_2,
                'trace'         => 1
            )
        );
    }

    function soapCall($function, $params){
        if(!$this->soap_client){$this->soapClient();}
        try { return $this->soap_client->__soapCall($function, $params);}
        catch (SoapFault $e) { trigger_error("SOAP Fault: [{$e->faultcode}] {$e->faultstring}", E_USER_ERROR); }
    }



    /*******************************************\
     *  VoIPms - API Functions
    \*******************************************/

    function getServersInfo($server_pop){
        $function = "getServersInfo";
        $params = array(
            "params" => array(
                "api_username"  => $this->api_username,
                "api_password"  => $this->api_password,
                "server_pop"    => $server_pop
            )
        );
        return $this->soapCall($function,$params);
    }
}
?>
                            
PHP5 - Using Class VoIPms - Sample Code

<?
require_once("class.voipms.php");
$voipms = new VoIPms();

echo "<pre>";


echo "
Display Specific Server
=======================
";
$response = $voipms->getServersInfo(1);
print_r($response);


echo "
Display All Servers
===================
";
$response = $voipms->getServersInfo();
print_r($response);


echo "</pre>";
?>
                            

Was this answer helpful?

« Back

Powered by WHMCompleteSolution