Introduction

A transfer session check ensures that you can create a system account on the remote server.

  • For root sessions, analyze the transfer session and validate whether you can transfer a username to the remote server.
  • For user transfer sessions, validate whether you can transfer a username to the remote server.

Analyze the transfer session

To confirm that the transfer session contains all of the items that you want to transfer, analyze the transfer session. To do this, use the WHM API 1 retrieve_transfer_session_remote_analysis function.

Select the tab below that corresponds to the method by which you wish to call the function:




include_once '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_user = getenv('REMOTE_USER');
$root_pass = getenv('REMOTE_PASSWORD');

$xmlapi = new xmlapi($ip , $root_user , $root_pass);
$xmlapi->set_output('json');

$settings = array('api.version'=>1, 'transfer_session_id' => 'remoteexamplecopya20140211211719FxjU');
$_result = $xmlapi->xmlapi_query('retrieve_transfer_session_remote_analysis' , $settings);

print $_result;



The function call returns the following list:

  • Transfer session settings.
  • Local and remote groups and users.
  • Databases and database users.
  • Packages and accounts (transfer items) that the transfer session contains.

The function only returns metadata, which resembles the following example:

The items and dbs containers are empty. These containers will hold accounts, packages, databases, and database users.

Validate the username

To ensure that the username is not currently in use, validate whether you can transfer that username to the remote server. To do this, use the WHM API 1 validate_system_user function.

Select the tab below that corresponds to the method by which you wish to call the function:




include_once '../xmlapi.php';

$ip = getenv('REMOTE_HOST'); 
$root_user = getenv('REMOTE_USER'); 
$root_pass = getenv('REMOTE_PASSWORD'); 

$xmlapi = new xmlapi($ip , $root_user , $root_pass); 
$xmlapi->set_output('json'); 

$settings = array(
  'api.version'=>1, 
  'user' => 'transferme'
); 

$_result = $xmlapi->xmlapi_query('validate_system_user' , $settings); 

print $_result;



The output contains the following Boolean values which you can use to check the username: