Development Guides Home >> Guide to the LiveAPI System >> LiveAPI Methods

Guide to the LiveAPI System - The fetch() Method

The fetch() method is a wrapper to return a hash reference from the cpanelprint() function, which retrieves a cPanel variable.

  • We deprecated this method.
  • To return a data result for a cPanel variable's value, use the cpanelprint() method.

Example

LiveAPI PHP Class

// Get a hashref of the cPanel account's username.
$cpanel->fetch('$user');

LiveAPI Perl Module

# Get a hashref of the cPanel account's username.
$cpliveapi->fetch('$user');

Parameters

Parameter Type Description Possible values Example
variable string A cPanel variable. A valid cPanel variable.

For a full list of cPanel variables, read our Guide to cPanel Variables documentation.
$user

Returns

This method returns the cPanel variable's value as a hash reference.