How to connect cPanel’s ports using XML-API (PHP Class)?

December 29, 2010 • By admincPanel

cPanel’s XML-API is a wonderful way of doing stuffs programitically and remotely on its front end (domain owner control panel) and back end (WHM). However, the PHP client of XML-API, by default, connects to WHM Ports!

If you are wondering how to connect to front end and do stuffs using user’s credentials rather than root credentials, this tutorial will help you. Indeed, it is very easy to do. You need a single line of code to connect front end.

Let’s assume $cpanel is a instance of XML-API class. Now you can change it’s target port by the following line

$cpanel->set_port(2082); //you must supply it as integer

However, if you wish to connect to secured port, it will be

$cpanel->set_port(’2083′);

To use the cpanel’s username & password, you just need assign authentication credentials as follows:

$cpanel->password_auth("cpuser","cppass");

How to connect cPanel's ports using XML-API (PHP Class)?, 1.0 out of 10 based on 1 rating