This class requires PHP5 with curl support and SimpleXML support (which is on by default). This class returns SimpleXML objects by default; however, it can be configured to return XML, JSON, or YAML.
Note: SimpleXML is a feature of PHP5 that allows XML to easily be transformed into data structures similar to associative arrays.
Download the cPanel Licensing PHP class from your Manage2 interface.
include("cpl.inc.php"); $cpl = new cPanelLicensing(__USERNAME__, __PASSWORD__);At this point, you are ready to call a function inside of the class. Each function uses named parameters, meaning that it has to be passed an associative array containing the URL parameters inside of it:
$args = array( "ip" => "192.168.1.1" ); $cpl->fetchLicense($args);Alternatively, this can be done inline:
$cpl->fetchLicense( array( "ip" => "192.168.1.1" );
set_formatallows one to choose what output type the PHP class will give. By default, this will return a SimpleXML object, but this class is capable of returning raw XML, JSON or YAML. This function takes a single parameter, which must be any of the following strings:
findKeyallows you to look up Package or Group IDs by name, and returns the ID. This function will only operate when the class is operating inside of SimpleXML mode. This function accepts two parameters:
$packages = $cpl->fetchPackages(); $packageid = $cpl->findKey("ONE-YEAR", $packages);