Current File : //scripts/CreateSoftaculousDomain.php
#!/usr/bin/php
<?php
if( $argc<=7) {
    echo "Please pass the proper arguments";exit;
} else {
    $api_key    = $argv[1];
    $api_pass   = $argv[2];
    $domain  	= $argv[3];
    $ftp_user 	= $argv[4];
    $ftp_pass 	= $argv[5];
    $username   = $argv[6];
    $ftp_path   = $argv[7];
}
$url = 'http://45.113.136.119/index.php?'.
	'api_key='.$api_key.
	'&api_pass='.$api_pass.
	'&api=serialize'.
	'&act=adddomain'.
	'&loginAs='.$username;
$data_dir = "/home/$ftp_user/datadir";

$post = array('add_domain' => 1,
	'domain' => $domain,
	//'server_host' => 'ftp.example.com', // Optional
	'ftp_user' => $ftp_user,
	'ftp_pass' => $ftp_pass,
	'ftp_path' => $ftp_path,
	//'ftp_path' => '/public_html',
	//'backup_path' => '/backups',
	'data_dir' => $data_dir,
	'protocol' => 'ftp',
	'port' => '21');
$time = time();
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Turn off the server and peer verification (TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

if(!empty($post)) {
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
 
// Get response from the server.
$resp = curl_exec($ch);
 
// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = unserialize($resp);
print_r($res); 
// Done ?
/*if(!empty($res['done'])) {
	print_r($res);
// Error
} else {
	echo 'Some error occured';
	print_r($res['error']);
}*/
return $res;
?>