
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_format allows 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: simplexml
xml
json
yaml
$cpl->set_format("json");
findKey allows 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: search and package SimpleXML objects.
$packages = $cpl->fetchPackages();
$packageid = $cpl->findKey("ONE-YEAR", $packages);