The LiveAPI PHP Class provides an environment for PHP applications. You can find this PHP class in the
cPanel & WHM version 11.28 and earlier used the LivePHP system, which provided similar functionality.
- PHP applications that use the LiveAPI PHP class must instantiate the
- PHP filenames must end in either the
- Save files to the
themerepresents the cPanel theme, or create a symlink to the appropriate files.
The following example script uses the LiveAPI PHP class to call the
DomainInfo::domains_data UAPI function:
Line 2 instantiates the
CPANEL object. This ensures that the script or application uses the LiveAPI PHP class.
Connect to cPanel & WHM
Line 5 uses the LiveAPI
new() method to connect to cPanel & WHM. For more information, read our LiveAPI Methods documentation.
- You must include this line in all LiveAPI PHP code.
- Only include this line once in any file.
Call cPanel & WHM API functions
Lines 8 through 13 use the
uapi() method to call the
DomainInfo::domains_data UAPI function, and assign the function's output as a hash reference to the
- You can call multiple functions in a single file.
- For more information and use examples, read that function's documentation. All cPanel API 1, cPanel API 2, and UAPI function documents include specific examples for the LiveAPI PHP class.
Perform the desired actions
Your script or application's actions could combine any of PHP's many functions.