Description

This function lists authorized remote hosts for the account's databases.


We strongly recommend that you use the following UAPI function instead of this function:

Examples 




https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=MysqlFE&cpanel_jsonapi_func=gethosts



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List authorized remote access hosts
$remote_hosts = $cpanel->api2(
    'MysqlFE', 'gethosts'
);

 



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List authorized remote access hosts
my $remote_hosts = $cpliveapi->api2(
    'MysqlFE', 'gethosts',
);

 




cpapi2 --user=username MysqlFE gethosts



{
  "cpanelresult": {
    "apiversion": 2,
    "data": [
      "hostname.example.com"
    ],
    "func": "gethosts",
    "event": {
      "result": 1
    },
    "module": "MysqlFE"
  }
}



Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
 array

A list of authorized database hostnames.

One or more valid database hostnames.
remote.example.com
reasonstring

A reason for failure.

This function only returns a reason value if it failed.


A string that describes the error.

This is an error message.
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1