I would like to have a basic code skeleton for doing cPanel API calls remotely but securely, using Windows PHP, to do some maintenance activities.

The problem I am facing is that most of the cPanel APIs are either inaccessible or deprecated, other than UAPI. And I cannot find an example of UAPI usage that works on a remote Windows computer.

Example (from https://stackoverflow.com/questions/35057175/calling-cpanel-uapi-method):

include 'cpanel.php';
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// List FTP account information.
$list_ftp_accts = $cpanel->uapi('Ftp', 'list_ftp');
echo "<pre>";

This is a simple example to list the ftp accounts using the UAPI interface.

The example fails for me because this interface is apparently for use only in a certain directory of the server (see above-cited problem report); it apparently cannot be used directly on a remote computer. I've heard a rumor that UAPI can be used via cURL from any computer, but I haven't seen any code to do this.

Examples of using other APIs are not included here, due to their length. But they also do not work on my remote Windows computer, for various reasons. And they are all more complicated than UAPI.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.