Some of the reasons why there hasn’t been many updates lately include our cPanel conference, the cPanel/WHM 11.25.0 release, and the release of the XML-API PHP class 1.0. If you are not familiar with the XML-API PHP class, it makes interacting with the XML-API much more simple by implementing functions that allow you to call your remote cPanel server without ever having to touch cURL or simplexml. This works by implementing a function for every XML-API call. For example:
$xmlapi = new xmlapi($ip, “root”, $root_pass);
$zones = $xmlapi->listzones();
The code above will make $zones a simplexml object that contains all of the zones on the server. This combined with proper data handling (encoding), the ability to return associative arrays, simplexml objects, raw JSON or raw XML makes developing PHP applications for the XML-API rather simple.
The biggest change in this version is the fact that the class is full documented, allowing you to access a quick reference for looking up these functions and how they work.
This version is a complete re-write from the previous version. The (partial) change log is below:
- Added in 11.25 functions
- Changed the constructor to allow for either the “DEFINE” config setting method or using parameters
- Removed used of the gui setting
- Added fopen support
- Added auto detection for fopen or curl (uses curl by default)
- Added ability to return in multiple formats: associative array, simplexml, xml, json
- Added PHP Documentor documentation for all necessary functions
- Changed submission from GET to POST
- Change api1 and api2 query to use XML-API fast mode
- added authentication failure detection for 11.24
- add array checking where array parameters are taken in
If you are interested in working with the XML-API PHP Class, you can download it here. If you want to provide feedback, bugs, or comments you can do so from the developer’s discussion forum
It should be noted that this is not an supported class, but rather released as reference code. If you need assistance with the class, the forum is the proper place to ask for help.