Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

LiveAPI

For cPanel & WHM 11.30

Our LiveAPI implementation is a set of environments you can access from within a cPanel & WHM plugin or application. Each environment provides a way for your scripts to interact locally with the cPanel binary, cpsrvd. This allows you to make API 1 and API 2 calls to the local machine via the socket.

Each class is an out-of-the-box environment that provides common elements for integrating with cPanel & WHM. When using these environments, API calls are executed by the system's user and may fail if asked to perform a task for which the user has insufficient permissions. The same rules apply to the LiveAPI as apply when using API tags (API 1/API 2) or calls with our Remote API (XML/JSON API).

Before using LiveAPI, you must:

  • Include the appropriate environment in your code and instantiate the respective class's object.
  • End file names with the appropriate file extension:
    • .livephp or .live.php — The extension for the LiveAPI PHP class.
    • .livepl or .live.pl — The extension for the LiveAPI Perl module.
  • Place your scripts in /usr/local/cpanel/base/frontend/$THEME. The system permits you to use symlinks.
    • note Note: You will need to replace $THEME in the example above with your theme. (x3 in most cases.)

note Note: If you are using an earlier version of cPanel & WHM, this same technology is provided by a precursor, LivePHP? . This implementation is specific to the PHP programming language only.

Available LiveAPI environments

The documents listed below correspond to LiveAPI environments that are currently available through cPanel & WHM. Future development and documentation will provide more environments and examples related to popular programming languages for the web.

  • The LiveAPI PHP Class — This is a PHP implementation of cPanel & WHM's LiveAPI environment. This document provides a set of basic instructions and examples for working with the LiveAPI PHP class. You can find this PHP class at /usr/local/cpanel/php/cpanel.php. An example script ships with cPanel & WHM and can be found at /usr/local/cpanel/base/frontend/x3/test.live.php.
  • The LiveAPI Perl Module — This is a Perl implementation of cPanel & WHM's LiveAPI environment. This document provides a set of basic instructions and examples for working with the LiveAPI Perl module. You can find this Perl module at /usr/local/cpanel/Cpanel/LiveAPI.pm. An example script ships with cPanel & WHM and can be found at /usr/local/cpanel/base/frontend/x3/test.live.pl.

cPanel & WHM 11.32's LiveAPI implementation also supports the following language environments; however, cPanel does not currently provide classes for them:

  • Ruby.liverb or .live.rb
  • Python.livepy or .live.py
  • CGI.livecgi or .live.cgi
    • note Note: You can use the LiveAPI Perl Module with the the CGI environment. An example script ships with cPanel & WHM and can be found at /usr/local/cpanel/base/frontend/x3/test.live.cgi.

Topic revision: r4 - 13 Jan 2012 - 15:57:18 - Main.JustinSchaefer