Softaculous Enterprise Integration

From Softaculous Wiki
Jump to: navigation, search

Contents

Overview

The following guide will show you how to install Softaculous Enterprise. Softaculous Enterprise Integration is suitable for a system where NFS access is possible. Softaculous will be installed on a single VM or dedicated server and will install applications over NFS. Softaculous Enterprise is suitable for a clustered setup where you have multiple servers which are connected over NFS.


Install Softaculous Enterprise

Requirements

  • A server with Root access.
  • If you have a firewall, then please allow access to download all packages from *.softaculous.com

Note : Please allow access to the following domains to your firewall as these are the mirrors used to download the script packages.

  • api.softaculous.com (IP : 192.198.80.3)
  • s1.softaculous.com (IP : 192.99.110.112)
  • s2.softaculous.com (IP : 192.200.108.99)
  • s3.softaculous.com (IP : 178.32.158.97)
  • s4.softaculous.com (IP : 138.201.24.83)
  • s7.softaculous.com (IP : 167.114.200.240)

IMPORTANT : Please do not use any other web server on this server because Softaculous will be using its own web server on port 80, 443, 2006 and 2007. Also do not install any other database as MySQL too will be installed by Softaculous and will be using port 3178.

Supported OS

  • CentOS
  • Ubuntu
  • Debian

Installing Softaculous

  • SSH to your server and enter following commands:
wget -N http://files.softaculous.com/install.sh
chmod 755 install.sh
./install.sh --enterprise
  • Note the API KEY and API PASSWORD given by the installer in the end. It will be used for Login and verification purpose.

That's it the installation of Softaculous Enterprise is completed! But you will need to do some coding before you can start using Softaculous.

Integrating

Softaculous Enterprise will need you to write a class which will tell Softaculous which user is logged in, what domains he owns, etc.

You need to create a file called /usr/local/softaculous/enduser/enterprise.php

We have provided a sample file called /usr/local/softaculous/enduser/enterprise.sample.php, so you can refer it to create /usr/local/softaculous/enduser/enterprise.php

There is a class called customPanel which is extended in Softpanel. All the functions which are given in the file are used in Softaculous.

Softpanel is the class created by us which will be the bridge between your panel and the Softaculous.

Don't rename any functions given in the customPanel class as it might break Softaculous.

Codes written in functions are simple examples which should be modified by you.

Below we have explained each function in detail so you can modify easily according to your panel needs.

function customPanel()

function customPanel(){
        
        // Connecting to the database with root privileges. This will be used to create database for any new installations.
	// Note: This is not compulsory and just an example
	$this->db = mysql_connect('localhost', 'root', 'mysql');
	if(!$this->db){
		die('Could not establish a connection to a database.');
	}
}
  • This is a Contructor.
  • If you want to execute anything when customPanel class is loaded you can put it here. For example you can connect to mysql as shown in above example.

function dbhost()

//The Host of the Database
function dbhost($type = 'mysql'){
	return 'localhost'; // If any other host please return that!	
}
  • Return value should be the hostname of the database.
  • This function is used to connect to a database where softaculous can propagate the database for scripts installed by users.

function maxdb()

//The Maximum Number of Database
function maxdb($type = 'mysql'){
	
	return 100000; // The max number of DBs allowed to this user. If a string is given it will be assumed as Unlimited!

}
  • Return value should be the max number of DBs allowed to this user. If a string is given it will be assumed as Unlimited!
  • This function is used to check that the user does not create more databases than allotted to them.

function dbsused()

// Number of dbs used
// If unlimited return a string
function dbsused(){		
	return 10;
}
  • This function is called to CHECK whether the existing number of databases is not GREATER than or EQUAL to (>=) the allowed number of Databases.
  • Return value should be an int or a string. If a string is given it will be assumed as Unlimited!


function dbname()

// Return the DBNAME as per the panel
// e.g if dbname is given and a prefix is required then please give it here
function dbname($dbname){		
	return $dbname;		
}
  • If the panel requires to modify the DB NAME that is to be created when installing a script, it has to be done here. Many panels e.g. cPanel accept input from users as DBNAME but create Databases like USERNAME_DBNAME. In such a case this function must return USERNAME_DBNAME or DBNAME

Parameter :

  • string $dbname : Database Name chosen by the user on script install form.


function dbuser()

// Return the DBUSERNAME as per the panel
// e.g if dbusername is given and a prefix is required then please give it here
function dbuser($dbuser){
	return $dbuser;		
}
  • If the panel requires to modify the Database USER NAME that is to be created when installing a script, it has to be done here. Many panels e.g. cPanel accept input from users as DBUSERNAME but create Databases like USERNAME_DBUSERNAME. In such a case this function must return USERNAME_DBUSERNAME or DBUSERNAME

Parameter :

  • string $dbuser : Database Name chosen by the user on script install form (we use the database username the same as the database name chosen by user).


function dbexists()

// Check whether the Database Exists
// Return true if it exists or false it doesnt
function dbexists($dbname){
	if(in_array($dbname, $this->listdbs())){
		return true;
	}
	return false;
}
  • This is a function to check whether the Database already exists or not

Should return TRUE or FALSE as the case may be.

Parameter :

  • string $dbname : Database Name chosen by user on script install form.

function dbuserexists()

// Check whether the Database User Exists
// Return true if it exists or false it doesnt
function dbuserexists($dbuser){
		if(in_array($dbuser, $this->listdbusers())){
				return true;
		}
		return false;
}
  • This is a function to check whether the Database USER already exists or not

Should return TRUE or FALSE as the case may be.

Parameter :

  • string $dbuser : Database Name chosen by the user on script install form (we use the database username the same as the database name chosen by user).

function createdb()

//This will create a Database
function createdb($dbname, $dbuser, $dbpass, $type = 'mysql'){

	$is_empty = $this->dbexists($dbname);
	if(!empty($is_empty)) return true;

	$result = $this->myquery("CREATE DATABASE ".$dbname, 0);
	$result = $this->myquery("GRANT ALL PRIVILEGES ON $dbname.* TO '$dbuser'@'192.168.17.131'
	IDENTIFIED BY '$dbpass'", 0);
	$result = $this->myquery("GRANT ALL PRIVILEGES ON $dbname.* TO '$dbuser'@'".$this->dbhost()."'
	IDENTIFIED BY '$dbpass'", 0);
		
	/* if(!$result){
		$GLOBALS['error'] = 'Could not create the database';
	} */

	return true;
	
}
  • $this->myquery IS JUST AN EXAMPLE. You can create your own functions and use it in the class.
  • This function should create the DATABASE and also the Database USER. The user must also be added to the database so that the user can conduct all necessary operations on the Database.
  • Return true if it is created successfully or false if there were any error
  • If there are any errors while creation of database please fill in $GLOBALS['error'][] = 'The error';

Parameters :

  • string $dbname - The is value that is returned by function dbname()
  • string $dbuser - The is value that is returned by function dbuser()
  • string $dbpass - The is a 10 characters randomly generated string that will be passed by Softaculous when createdb() is called.

function deldb()

//Delete a Database and user
function deldb($dbname, $dbuser, $type = 'mysql'){

	$result = $this->myquery("DROP DATABASE ".$dbname, 0);
	$result = $this->myquery("DROP USER '".$dbuser."'@'192.168.17.131'", 0);
	$result = $this->myquery("DROP USER '".$dbuser."'@'".$this->dbhost()."'", 0);
	return true;

}
  • $this->myquery IS JUST AN EXAMPLE. You can create your own functions and use it in the class.
  • This function should delete the DATABASE and also the Database USER.


Parameters passed :

  • string $dbname - This is the value that is returned by function dbname()
  • string $dbuser - This is the value that is returned by function dbuser()


function spaceremain()

//Shows the Disk Space Available
function spaceremain(){
	
	// Note: 1) Should be in BYTES
	//		 2) If it is not numeric then SOFTACULOUS will assume as UNLIMITED space
	
	$space = (1024*1024*1024); // e.g. of a GB
	
	return $space;
	
}
  • Should return the space available in BYTES. If a string is returned it will be assumed that the user has unlimited space remaining.


function addcron()

// Add a CRON JOB
function addcron($min, $hour, $day, $month, $weekday, $command, $mail = ''){	
	
	return true;
	
}
  • Add a CRON job for the script.


Parameters passed :

  • $min
  • $hour
  • $day
  • $month
  • $weekday
  • $command - The CRON Command itself.

function delcron()

// Deletes a CRON JOB as per the command given
function delcron($command){

	return true;
	
}
  • Delete a CRON job of a installation.


Parameters passed :

  • $command - The CRON Command itself. You will have to search and delete the cron job accordingly.

function blacklist_domains() (Optional)

This function is optional. Choose list of domains you want to exclude for the user from existing list of domains owned by that user. Return array list of domains you want to blacklist with domain name as the key

* @param array $domains Existing Domains list under the user's account.
function blacklist_domains($domains){
	$blacklist_domains = array();
	return $blacklist_domains;
}

function listcpplans() (Optional)

This function is optional. You can use this function to pass a list of plans by fetching it from your control panel. Once you pass the control panel plans here you will be able to create an ACL for users from Softaculous Admin panel -> Plans and assign scripts to the user as per the plan he is under. Return array list of control panel plans

function listcpplans(){
	$cpplans = array();	
	return $cpplans;
}

User Management

Types of Users

There are three types of Users in Softaculous Enterprise :


Admin User

  • There is only one Admin User i.e root and is added by default during the installation.
  • Owner and Username of Admin User is root
  • It is responsible for handling the scripts, users, domains and other settings.
  • Admin can create Reseller as well as Regular Users.
  • Like Regular users even Admins can use the Enduser Panel and install scripts.

Reseller User

  • Only Admin can create Resellers.
  • Resellers can be added from Admin Panel only.
  • Number of users allotted to Reseller should be more by one because reseller himself is counted as a user. E.g If Admin has allotted 10 number of users then Reseller can add total 9 Regular Users under his account.
  • Resellers can create Regular Users.
  • Like Regular users even Resellers can use the Enduser Panel and install, remove and manage scripts.
  • If the Reseller is 'xyz' then the owner and the username of his accounts will be 'xyz'.

Regular User

  • Regular Users can be created by Admin or Resellers.
  • Owner of the Regular User will the User who is creating the user, it can be Admin(root) or Reseller.
  • They can install, remove, update, manage scripts from Enduser Panel.
  • The owner and the username of the Regular users create by a Reseller will be :
    • Owner => Reseller's Username(xyz in above example)
    • Username => User name of the regular user just created
  • The owner and the username of the Regular users create by Admin will be :
    • Owner => root
    • Username => User name of the regular user just created


Authentication Methods

There are three possible ways to login into Softaculous Enterprise :

Default Login

  • Access your server through browser <your-server-ip> or <your-domain>
  • Enter the API KEY and API PASS provided by the Softaculous Installer or your host to login into Softaculous Enterprise.

Default Login Page

Login Code

This is optional part and Softaculous will use the default session handling.

  • Softaculous allows you to dynamically handle the session and define the User details and Domains to be listed under the user. This can be done using session.php where you can communicate with your control panel and validate the current user's session.
  • If session.php is created Softaculous will skip the authentication part and will assume that the session is authenticated by you.
  • You can define the user details i.e. username, owner, email and the domains owned by the current logged in user in $PRE_LOGIN array.
  • When Softaculous is loaded it will add the user and domains defined in $PRE_LOGIN if it does not exist in Softaculous database.
  • You can refer to the session.sample.php located at /usr/local/softaculous/enduser/session.sample.php

Variable Example Description
$PRE_LOGIN['username'] test Username who will be accessing Softaculous Enterprise. Admin user is root which is created during installation time. If the username passed here does not exist in Softaculous Enterprise database it will be added.
$PRE_LOGIN['owner'] (Optional) root Owner who will own this account. This is not the username but this is the user who will own the account. If not specified 'root' will be assumed. Default owner is root which is created during installation time.
$PRE_LOGIN['email'] user@email.com Email of the username. This is used to send emails like whether Install, Remove, Update of Scripts were successful or not.
$PRE_LOGIN['plan'] (Optional) platinum This is used to specify which control panel plan does this user falls under. Refer [[1]] for defining control panel plans
$PRE_LOGIN['uid'] 505 UID is used to chown the directory of the installations of scripts installed by Softaculous. This is required to set the proper permission of the files/folder while installing, updating, the scripts.
$PRE_LOGIN['gid'] (Optional) 505 GID of the username. If not specified GID's value will be assumed same as UID's value. This is required to set the proper permission of the files/folder while installing, updating, the scripts.
$PRE_LOGIN['domains'][0]['domain'] domain.com Domain Name where the users will be installing the scripts
$PRE_LOGIN['domains'][0]['path'] /NFS/a/var/www/html Full path of the web accessible directory.
$PRE_LOGIN['domains'][0]['backupdir'] /NFS/a/var/www Full Path of the Backup Directory. Backups created by Softaculous will be located here.
$PRE_LOGIN['domains'][0]['replace_path'] /NFS/a This "Replace Path" will be replaced with empty in PATH to get the correct path according to scripts. According to the scripts PATH mentioned above is not correct as we are on NFS. We have to generate a new path with respect to scripts.
$PRE_LOGIN['domains'][0]['datadir'] /NFS/a/var/www Absolute path of the Data Directory. Some scripts like Elgg, Moodle, etc need a non web accessible folder.

Example

// Write your code to authenticate the session with your control panel
if(!$authenticated){
	die('Could not validate session');
}

$PRE_LOGIN['owner'] = 'root'; // Owner
$PRE_LOGIN['username'] = 'test'; // Username
$PRE_LOGIN['email'] = 'user@email.com'; // Email
$PRE_LOGIN['plan'] = 'platinum'; // Control Panel Plan

$PRE_LOGIN['uid'] = '505';
$PRE_LOGIN['gid'] = '505';

// Domain 1 details
$PRE_LOGIN['domains'][0]['domain'] = 'domain1.com';
$PRE_LOGIN['domains'][0]['path'] = '/NFS/a/var/www/html';
$PRE_LOGIN['domains'][0]['backupdir'] = '/NFS/a/var/www';
$PRE_LOGIN['domains'][0]['replace_path'] = '/NFS/a';
$PRE_LOGIN['domains'][0]['datadir'] = '/NFS/a/var/www';

// Domain 2 details
$PRE_LOGIN['domains'][1]['domain'] = 'domain1.com';
$PRE_LOGIN['domains'][1]['path'] = '/NFS/a/var/www/html/domain1';
$PRE_LOGIN['domains'][1]['backupdir'] = '/NFS/a/var/www';
$PRE_LOGIN['domains'][1]['replace_path'] = '/NFS/a';
$PRE_LOGIN['domains'][1]['datadir'] = '/NFS/a/var/www';


// You can also define the following optional constants
define('SOFT_LOGOUT_URL', 'http://YOUR_LOGOUT.URL'); // Define your custom logout URL here
define('SOFT_LOGOUT_REDIRECT', 'http://YOUR_REDIRECT.URL'); // Define the URL where you want the user to be redirected after logging out using default logout URL
define('SOFT_SIGNIN_REDIRECT', 'http://YOUR_SIGNIN.URL'); // Define the URL where you want the user to be redirected for login


Sync Domains

  • When the domains are passed using $PRE_LOGIN['domains'] array described in the previous section the domain is synced with the Softaculous Enterprise database and if the domain does not exist in Softaculous Enterprise database the domain is added automatically.
  • However if you remove a domain from the $PRE_LOGIN['domains'] array it will not be deleted from Softaculous Enterprise database. In order to delete the domains when they are not passed in $PRE_LOGIN['domains'] you will need to enable the Enable Sync Domain(s) from Softaculous Admin Panel -> Settings page. Once this setting is enabled the domains passed in $PRE_LOGIN['domains'] will be in sync with the database and only the domains passed in $PRE_LOGIN['domains'] will be present in the database.

Session Tokens

  • Refer to Session Tokens for creating session tokens which can be used to redirect the user to Softaculous Enterprise with the session created. The user will not have to do anything to login in this method as the session is created by the Admin here for automation purposes.

How to use Softaculous Enterprise

  • To access Enduser Panel visit http://<your-ip> or http://<your-domain> and (Port 443 for HTTPS)
  • To access Admin Panel visit http://<your-ip>:2006 and (Port 2007 for HTTPS)
  • To access phpMyAdmin visit http://<your-ip>/phpmyadmin/index.php or http://<your-domain>/phpmyadmin/index.php (index.php in the end is compulsory)
  • MySQL root password is stored at /usr/local/softaculous/conf/myconf

WEB API

List Scripts

Key Value Description
Authentication - You can use the Enduser Authenticating or Admin Authentication methods.
act blank or any Any act will do as this is available everywhere.


Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&act=home'.
			'&api=serialize';

// 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);
 
// Get response from the server.
$resp = curl_exec($ch);

// Unserialize data
$res = unserialize($resp);

// The Installed scripts list is in the array key 'iscripts'
print_r($res['iscripts']);


Install a Script

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act software, js, perl The value should be "software" to install PHP script, "js" to install a JavaScript and "perl" to install a PERL script for softaculous to perform the action of installing a software.
soft 26 (26 is the Script ID of WordPress) The value should be "SID" for softaculous to perform the action of installing a software. You can find the list of sid's here
POST
softsubmit 1 This will trigger the install
softdomain domain.com This is the domain on which you wish to install the script
softdirectory wp This is the sub-directory to install the script in. Leave it blank to install in root of the domain
softdb wp123 This is the database name for the script. If the script does not require database you can leave this blank
dbusername wp123 This is the database user(Only for Softaculous Remote)
dbuserpass w1XRF28mq8 This is the database password. You can generate a random password(Only for Softaculous Remote)
hostname localhost This is the hostname of your MySQL server. You can enter your MySQL server IP if you have MySQL on a remote server(Only for Softaculous Remote)
admin_username admin This is the admin account username for the installation
admin_pass pass This is the admin account password for the installation
admin_email admin@domain.com This is the admin account email address for the installation
language en Language for the installation. You can get the language codes from the respective install.xml
site_name My Blog Site Name for the installation
site_desc My WordPress Blog Site Description for the installation
dbprefix dbpref_ (Optional) Table Prefix to be used for the tables created by application
noemail 1 (Optional) - Use this only if you do not want to send an email to the user
overwrite_existing 1 (Optional) - Use this only if you do not want Softaculous to check for existing files in installation path. If any file(s) exists they will be overwritten.


Example

// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=software'.
                        '&soft=26';

$post = array('softsubmit' => '1',
              'softdomain' => 'example.com', // Must be a valid Domain
              'softdirectory' => 'wp', // Keep empty to install in Web Root
              'softdb' => 'wpdb',
              'dbusername' => 'dbusername',
              'dbuserpass' => 'dbuserpass',
              'hostname' => 'localhost',
              'admin_username' => 'admin',
              'admin_pass' => 'adminpassword',
              'admin_email' => 'admin@example.com',
              'language' => 'en',
              'site_name' => 'WordPress Site',
              'site_desc' => 'My Blog',
              'dbprefix' => 'dbpref_'
);

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Edit an Installation

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act editdetail The value should be "editdetail" for softaculous to perform the action of editing an installation.
insid 26_12345 The installation ID that you want to edit. It can be fetched from List Installed Script
POST
editins 1 This will trigger the edit function
edit_dir /home/USERNAME/public_html (Optional) Path to installation. If not posted the path in existing records will be used.
edit_url http://example.com (Optional) URL to installation. If not posted the URL in existing records will be used.
edit_datadir /home/USERNAME/datadir (Optional) Path to data directory of the installation. If not posted the data directory in existing records will be used.
edit_dbname username_dbname (Optional) Database name for the installation. If not posted the Database name in existing records will be used.
edit_dbuser username_dbuser (Optional) Database user for the installation. If not posted the Database user in existing records will be used.
edit_dbpass dbpass (Optional) Password of the database user for the installation. If not posted the password in existing records will be used.
edit_dbhost localhost (Optional) Database host for the installation. If not posted the Database host in existing records will be used.
eu_auto_upgrade 1 (Optional) 1 to Enable auto upgrade option and 0 to disable. If not posted the existing setting will not be changed.
auto_upgrade_plugins 1 (Optional) 1 to Enable auto upgrade plugins option and 0 to disable. If not posted the existing setting will not be changed. (Currently this option is supported only in WordPress)
auto_upgrade_themes 1 (Optional) 1 to Enable auto upgrade themes option and 0 to disable. If not posted the existing setting will not be changed. (Currently this option is supported only in WordPress)
noemail 1 (Optional) - Use this only if you do not want to send an email to the user


Example

// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=editdetail'.
                        '&insid=26_12345';

$post = array('editins' => '1',
              'edit_dir' => '/path/to/installation/', // Must be the path to installation
              'edit_url' => 'http://example.com', // Must be the URL to installation
              'edit_dbname' => 'wpdb',
              'edit_dbuser' => 'dbusername',
              'edit_dbpass' => 'dbuserpass',
              'edit_dbhost' => 'dbhost'
);

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}

// Print the entire output just incase !
print_r($res);


Upgrade an Installed Script

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act upgrade The value should be "upgrade" for softaculous to perform the action of upgrading an installation.
insid 26_12345 The installation ID that you want to upgrade. It can be fetched from List Installed Script
POST
softsubmit 1 This will trigger the upgrade


Example

// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=upgrade'.
                        '&insid=26_12345';

$post = array('softsubmit' => '1');

// 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);
 
// Done ?
if(!empty($res['done'])){

	// There might be some task that the user has to perform
	if(!empty($res['setupcontinue'])){

		echo 'Please visit the following URL to complete upgrade : '.$res['setupcontinue'];	

	// It upgraded
	}else{

		echo 'Upgraded successfully. URL to Installation : '.$res['__settings']['softurl'];	

	}

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}

// Print the entire output just incase !
print_r($res);


Clone an Installed Script

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act sclone The value should be "sclone" for softaculous to perform the action of cloning an installation.
insid 26_12345 The installation ID that you want to clone. It can be fetched from List Installed Script
POST
softsubmit 1 This will trigger the upgrade
softdomain domain.com This is the domain on which you wish to clone the installation
softdirectory wp This is the sub-directory to clone the installation in. Leave it blank to clone in root of the domain
softdb wp123 This is the database name for the cloned installation. If the script does not require database you can leave this blank.


Example

// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=sclone'.
                        '&insid=26_12345';

$post = array('softsubmit' => '1',
              'softdomain' => 'example.com', // Must be a valid Domain
              'softdirectory' => 'wp', // Keep empty to install in Web Root
              'softdb' => 'wpdb'
);

// 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);
 
// Done ?
if(!empty($res['done'])){

	echo 'Cloned successfully. URL to Installation cloned installation : '.$res['__settings']['softurl'];

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}

// Print the entire output just incase !
print_r($res);


Remove an Installed Script

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act remove The value should be "remove" to perform the action of removing an installed script.
insid 8 (Installation ID) Installation ID of the installed script. It can be fetched from List Installed Script
POST
removeins 1 This will trigger the remove install process
remove_dir 1 This is to remove the directory where the script is installed. If you do not want to remove the directory do not pass this key in post.
remove_datadir 1 This is to remove the data directory where the script is installed. If you do not want to remove the data directory do not pass this key in post.
remove_db 1 This is to remove the database of the installation. If you do not want to remove the database do not pass this key in post.
remove_dbuser 1 This is to remove the database user of the installation. If you do not want to remove the database user do not pass this key in post.
noemail 1 (Optional) - Use this only if you do not want to send an email to the user


Example

// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=remove'.
                        '&insid=8';

$post = array('removeins' => '1',
              'remove_dir' => '1', // Pass this if you want the directory to be removed
              'remove_datadir' => '1', // Pass this if you want the data directory to be removed
              'remove_db' => '1', // Pass this if you want the database to be removed
              'remove_dbuser' => '1' // Pass this if you want the database user to be removed
		);

// 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);


Import an Installation

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act import The value should be "import" to perform the action of importing an installation.
soft 26 (26 is the Script ID of WordPress) The value should be "SID" for softaculous to perform the action of installing a software. You can find the list of sid's here
POST
softdomain example.com This will be the domain where your script is installed. Domain should be without http:// or https://
softdirectory wp (OPTIONAL) This will be the directory under the domain where your script is installed. Leave this blank if the script is installed in the root of domain.
softsubmit 1 This will trigger the import function.

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=import'.
			'&soft=26';

$post = array('softsubmit' => 1,
		'softdomain' => 'example.com',
		'softdirectory' => 'wp');

// 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);


List Installed Script

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act installations The value should be "installations" to perform the action of listing installations.
showupdates true (OPTIONAL) The value should be "true" if you want to list only installations that have an update available for softaculous to perform the action of listing installations.

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=installations';


// 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);


List Backups

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act backups The value should be "backups" to perform the action of listing backups.

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=backups';


// 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);


Backup an Installed Script

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act backup The value should be "backup" to perform the action of taking the backup of the installation.
insid 26_5454 (Installation ID) Installation ID of the installed script. It can be fetched from List Installed Script
POST
backupins 1 This will trigger the backup function.
backup_dir 1 This is to backup the directory
backup_datadir 1 This is to backup the data directory
backup_db 1 This is to backup the database
noemail 1 (Optional) - Use this only if you do not want to send an email to the user

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=backup'.
			'&insid=26_4545';

$post = array('backupins' => '1',
              'backup_dir' => '1', // Pass this if you want to backup the directory
              'backup_datadir' => '1', // Pass this if you want to backup the data directory
              'backup_db' => '1', // Pass this if you want to backup the database
		);

// 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);


Restore an Installed Script

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act restore The value should be "restore" to perform the action of restoring the backup of the installation.
restore backup_time_insid.tar.gz (Backup File Name) Name of the Backup File. It can be fetched from List Backups
POST
restore_ins 1 This will trigger the restore function.
restore_dir 1 This is to restore the directory
restore_datadir 1 This is to restorethe data directory
restore_db 1 This is to restore the database
noemail 1 (Optional) - Use this only if you do not want to send an email to the user

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=restore'.
			'&restore=backup_time_insid.tar.gz';

$post = array('restore_ins' => '1',
              'restore_dir' => '1', // Pass this if you want to restore the directory
              'restore_datadir' => '1', // Pass this if you want to restore the data directory
              'restore_db' => '1', // Pass this if you want to restore the database
		);

// 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);


Download Backups

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act backups The value should be "backups" to perform the action of downloading the backup of an installation.
download backup_time_insid.zip (Backup File Name) Name of the Backup File. It can be fetched from List Backups

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=backups'.
			'&download=backup_time_insid.zip';


// 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);


Delete Backups

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act backups The value should be "backups" to perform the action of downloading the backup of an installation.
remove backup_time_insid.zip (Backup File Name) Name of the Backup File. It can be fetched from List Backups

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=backups'.
			'&remove=backup_time_insid.zip';


// 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);


Edit Enduser Settings

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act settings The value should be "settings" to perform the action of updating the settings of a user.
POST
editsettings 1 This will trigger the edit settings function
language english The language you want to set for the user.
timezone 0 This is the timezone that you want to set for the user. User 0 to set the timezone to Server Default.

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=settings;

$post = array('editsettings' => 1,
		'language' => 'english',
		'timezone' => '0');


// 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);


Edit Enduser Email Settings

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act email The value should be "email" to perform the action of updating the email settings of a user.
POST
editemailsettings 1 This will trigger the edit email settings function
email admin@example.com (Optional) Pass a valid email to receive the updates, leave blank to leave the email unchanged.
ins_email 1 (Optional) Pass this as 1 to enable receiving email for new installations, off to disable the same.
rem_email 1 (Optional) Pass this as 1 to enable receiving email after removing an installation, off to disable the same.
editdetail_email 1 (Optional) Pass this as 1 to enable receiving email after editing an installation, off to disable the same.
backup_email 1 (Optional) Pass this as 1 to enable receiving email after backup of an installation, off to disable the same.
restore_email 1 (Optional) Pass this as 1 to enable receiving email after restore of an installation, off to disable the same.
clone_email 1 (Optional) Pass this as 1 to enable receiving email after cloning an installation, off to disable the same.
disable_all_notify_update 1 (Optional) Pass this as 1 to disable receiving update available notification email, off to enable the same.

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=email;

$post = array('editemailsettings' => 1,
		'email' => 'admin@example.com',
		'ins_email' => '1');


// 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);


Auto Sign On

Key Value Description
Authentication - You can use the Enduser Authenticating or Admin Authentication methods.
act sign_on The value should be "sign_on" to perform the action to get the sign on URL.
insid 26_12345 The installation ID that you want to edit. It can be fetched from List Installed Script
autoid abcdefghijklmnopqrstuvwxyz0123456789 This must be any 32 character random string.

Example

// The URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=sign_on'.
                        '&insid=26_12345'.
                        '&autoid=abcdefghijklmnopqrstuvwxyz0123456789';


// 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);

// Get response from the server.
$resp = curl_exec($ch);

On using this API, you will get the sign_on_url, upon accessing which the user will be logged in to the admin panel of the script. You can use the same URL to redirect the user as shown here:

$op = unserialize($resp);
header('Location: '.$op['sign_on_url']);



Domains Functions

List Domains

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act domains This will list the domains under the account that you are logged in as.


Example
// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=domains';

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Add Domain

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act adddomain This will trigger the add domain function under the account that you are logged in as.
POST
add_domain 1 This will trigger the add domain function
domain domain.com Name of the domain to be added
server_host ftp.domain.com (Optional) This is the server host which will be used as the host to connect via FTP/FTPS/SFTP.
ftp_user ftp_user User to connect to the FTP/FTPS/SFTP server
ftp_pass ftp_pass Password for User to connect to the FTP/FTPS/SFTP server
ftp_path /public_html Path to the directory relative to home directory of user for installations
backup_path /backups Path to the directory relative to home directory of user for storing backups
data_dir /datadir Path to the data directory which will be used to create data directories required by some scripts like Moodle. This should not be accessible by webserver.
protocol (Optional) ftp, ftps, sftp (Default: ftp) The Protocol to use for this domain
port 21 Port number to connect to the FTP/SFTP/FTPS server. FTP default is 21.
public_key (Optional) Public Key Path to Public Key. Specify only when sftp protocol is used
private_key (Optional) Private Key Path to Private Key. Specify only sftp protocol is used
passphrase (Optional) Passphrase Passphrase for Private Key. Specify only sftp protocol is used


Example
// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=adddomain';


$post = array('add_domain' => 1,
		'domain' => 'example.com',
		'server_host' => 'ftp.example.com', // Optional
		'ftp_user' => 'ftp_user',
		'ftp_pass' => 'ftp_pass',
		'ftp_path' => '/public_html',
		'backup_path' => '/backups',
		'data_dir' => '/datadir',
		'protocol' => 'ftp',
		'port' => '21');

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Edit a Domain

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act editdomain This will trigger the edit domain function under the account that you are logged in as.
did 1 This will will be the domain id of the domain which you want to edit. You can use the List Domains function.
POST
edit_domain 1 This will trigger the edit domain function
domain domain.com This is the updated domain
server_host ftp.domain.com (Optional) This is the updated server host which will be used as the host to connect via FTP/FTPS/SFTP.
ftp_user ftp_user This is the updated FTP User
ftp_pass ftp_pass This is the updated FTP Pass
ftp_path /public_html This is the updated FTP Path
backup_path /backups This is the updated backup path
data_dir /datadir This is the updated data directory
protocol (Optional) ftp, ftps, sftp (Default: ftp) The Protocol to use for this domain
port 21 This is the updated port
public_key (Optional) Public Key Path to Public Key. Specify only when sftp protocol is used
private_key (Optional) Private Key Path to Private Key. Specify only sftp protocol is used
passphrase (Optional) Passphrase Passphrase for Private Key. Specify only sftp protocol is used


Example
// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=editdomain'.
			'&did=1';


$post = array('edit_domain' => 1,
		'domain' => 'example.com',
		'server_host' => 'ftp.example.com', // Optional
		'ftp_user' => 'ftp_user',
		'ftp_pass' => 'ftp_pass',
		'ftp_path' => '/public_html',
		'backup_path' => '/backups',
		'data_dir' => '/datadir',
		'protocol' => 'ftp',
		'port' => '21');

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Delete a Domain

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act domains This will trigger the domains function under the account that you are logged in as.
delid 1 This will will be the domain id of the domain which you want to delete. You can use the List Domains function.
cleanins 1 (Optional) Passing this as 1 will delete all the installations under this domain. If you do not want to delete the installations for the domain being deleted leave this parameter empty.


Example
// URL
$url = 'http://your.softaculous.com/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=domains'.
			'&delid=1'.
			'&cleanins=1';

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Admin Panel API

List Users

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act listuser This will trigger the list users function.


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=listuser';

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Add User

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act adduser This will trigger the add user function.
POST
saveuser 1 This will trigger the add user function
username testuser This is the username of the user you want to add
user_email admin@example.com This is the email of the user you want to add
num_users 0 (OPTIONAL) Leave this 0 if this is user is an enduser. If Reseller add the number of users they should be allowed to create


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=adduser';


$post = array('saveuser' => 1,
		'username' => 'testuser',
		'user_email' => 'admin@example.com',
		'num_users' => '0');

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Edit User

Key Value Description
Authentication - You can use the Enduser Authenticating or Admin Authentication methods.
act listuser This will trigger the edit user function.
nof 10 This will be the updated number of users to be allotted (Can be used for Reseller users only)
email email@xyz.com This will be the Email ID to be set for the user
updateuser newuser This is the new username that you want to set (Can be changed for non-reseller users only)
moduser testuser This is the username of the user you want to edit
modowner testuser This is the owner of the reseller. In case of Resellers they are owned by themselves


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&email=email@xyz.com'.
			'&act=listuser'.
			'&nof=10'.
			'&updateuser=newuser'.
			'&moduser=testuser'.
			'&modowner=testuser';

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}

Delete User

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act listuser This will trigger the delete user function.
deluser testuser This will be the username of the user to be deleted
delowner root This is the owner username of the user you want to delete. Default owner is root if the user is not created by a reseller.


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=listuser'.
			'&deluser=testuser'.
			'&delowner=root';

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


List Installations (Admin Panel)

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act installations This will trigger the list installations function.
POST
listinstallations 1 This will trigger the listinstallations function
users root;user1; (Optional) Pass ; separated list of users to filter installations by users
scripts WordPress;Joomla; (Optional) Pass ; separated list of scripts to filter installations by scripts


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=installations';

$post = array('listinstallations' => 1);

// 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);
 
// Done ?
if(!empty($res)){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


List Real Version (Admin Panel)

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act installations This will trigger the list installations function.
POST
listinstallations 1 This will trigger the listinstallations function
only_realversion 1 This will trigger the only_realversion function to list only installations in which the version in Softaculous records do not match with actual installation version

Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=installations';

$post = array('listinstallations' => 1, 'only_realversion' => 1);

// 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);
 
// Done ?
if(!empty($res)){

	print_r($res);

}


Update Real Version (Admin Panel)

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act installations This will trigger the list installations function.
POST
listinstallations 1 This will trigger the listinstallations function
only_realversion 1 This will trigger the only_realversion function to list only installations in which the version in Softaculous records do not match with actual installation version
list array('username-26_68351', 'username-26_68352') This will contain the array list for the installations which needs to be updated in Softaculous record(you will need to pass installation id which you will get from Real Version response in List Real Version

Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=installations';

$post = array('listinstallations' => 1, 'only_realversion' => 1, 'list' => array('username-26_68351', 'username-26_68352'));

// 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);
 
// Done ?
if(!empty($res)){

	print_r($res);

}


Installation Statistics (Admin Panel)

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act ins_statistics This will trigger the installation statistics function


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=ins_statistics';

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Add Plan (ACL)

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act addplans This will trigger the add plan function
POST
saveplan 1 This will trigger the add plan function
planname plan1 Plan name for the new plan being created
resellers_abc 1 (Optional) Use this only if you want to add a reseller to the plan. resellers_ is the prefix for adding a reseller and abc is the name of the reseller (that should already exist). Similarly pass a separate key for each reseller you want to add to the plan.
users_xyz 1 (Optional) Use this only if you want to add a user to the plan. users_ is the prefix for adding a user and xyz is the name of the user (that should already exist). Similarly pass a separate key for each user you want to add to the plan.
scripts_26 1 Use this to pass the scripts to be added to the plan. scripts_ is the prefix for adding a script and 26 is the id of the script to be added. Similarly pass a separate key for each script you want to add to the plan. Get Script ids


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=addplans';

$post = array('saveplan' => '1',
	'planname' => 'plan1',
	'resellers_abc' => '1',
	'users_xyz' => '1',
	'scripts_26' => '1', // Add WordPress
	'scripts_413' => '1' // Add Joomla
); 

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Edit Plan (ACL)

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act editplans This will trigger the edit plan function
plan plan1 This will be the plan name of the plan you want to edit
POST
saveplan 1 This will trigger the add plan function
planname plan1 Plan name for the new plan being created
resellers_abc 1 (Optional) Use this only if you want to assign a reseller to the plan. resellers_ is the prefix for adding a reseller and abc is the name of the reseller (that should already exist). Similarly pass a separate key for each reseller you want to assign to the plan.
users_xyz 1 (Optional) Use this only if you want to assign a user to the plan. users_ is the prefix for assigning a user and xyz is the name of the user (that should already exist). Similarly pass a separate key for each user you want to assign to the plan.
scripts_413 1 Use this to pass the scripts to be assigned to the plan. scripts_ is the prefix for assigning a script and 26 is the id of the script to be assigned. Similarly pass a separate key for each script you want to assign to the plan. Get Script ids


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=editplans'.
			'&plan=plan1';

$post = array('saveplan' => '1',
	'planname' => 'plan1',
	'resellers_abc' => '1',
	'users_xyz' => '1',
	'scripts_543' => '1', // Add Drupal
	'scripts_72' => '1' // Add PrestaShop
); 

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Delete Plan (ACL)

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act plans This is the default plans page act
delete plan1 This will be the plan name of the plan you want to delete


Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=plans'.
			'&delete=plan1';

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}


Enable / Disable Script

Key Value Description
Authenitcation - You can use the Enduser Authenticating or Admin Authentication methods.
act softwares This will trigger the enable/disable script function
POST
updatesoft Update Settings This will trigger the submit function for enabling/disabling the scripts
soft_26 1 Use it to Enable Script from Admin Panel. soft_ is the prefix for enabling a script and 26 is the id of the script to be enabled. Similarly pass a separate key for each script you want to enable. Get Script ids

Note: If you have 10 scripts Enabled. You want to Enable 1 more script you will need to pass all 11 scripts id in the POST data for it to Enable the script. The scripts which are not posted will be disabled.

Example

// URL
$url = 'http://your.softaculous.com:2006/index.php?'.
			'api_key=TESTAPIKEY'.
			'&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'.
			'&api=serialize'.
			'&act=softwares';

$post = array('updatesoft' => 'Update Settings',
	'soft_26' => 1, // WordPress
	'soft_18' => 1, // Joomla 2.5
	'soft_543' => 1, // Drupal 8
	'soft_11' => 1, // Open Blog
	'soft_3' => 1, // Serendipity
	'soft_34' => 1, // Dotclear
	'soft_14' => 1, // b2evolution
	'soft_470' => 1 // Ghost
);

// 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);
 
// Done ?
if(!empty($res['done'])){

	print_r($res);

// Error
}else{

	echo 'Some error occured';
	print_r($res['error']);

}

SDK

  • The Softaculous Enterprise SDK allows to perform all the basic functions performed by Softaculous Enterprise.
  • The API simplifies task such as Installing Scripts, Removing Scripts, Creating Domains, Deleting Domains, Adding Users, Removing Users, Editing User Details and such similar functions.
  • You can find the files in /usr/local/softaculous/sdk/ namely sdk.php and enterprise_sdk.php
  • Enterprise_API extends Softaculous_API (Softaculous SDK)
  • To Install, Remove, Upgrade installations refer Softaculous API.

List of Functions in Short

Here is the list of functions available for the developers:

Function Description For User Parameters
function createSession($username, $owner, $ip_address) Create Session Tokens All string $username The Username of the user
string $owner The owner of the user account
string $ip_address IP address where created session will be allowed.
function switchUser($username, $owner) Switch User Admin/Reseller string $username The Username of the user
string $owner The owner of the user account
function list_domains() List Domains Admin/Reseller -
function add_domain($domain, $username, $path, $backup_dir, $replace_path, $data_dir) Add a Domain Admin/Reseller string $domain The Domain name
string $username The username of the User who owns the domain
string $path Full path to web accessible directory
string $backup_dir Backup Directory
string $replace_path Replace path.(explained in detail below)
string $data_dir Data Directory for the user.
function delete_domain($domain, $delowner, $deluser) Delete a Domain Admin/Reseller string $domain The Domain name
string $delowner The owner of the user
string $deluser the username who owns the domain
function list_users() List of Users Admin/Reseller -
function adduser($username, $email, $uid, $gid, $num_users) Add a User Admin/Reseller string $username User Name to add
string $email Email of the user
string $uid UID of the user
$gid GID of the user
string $num_users (Optional) Number of Users a Reseller can add. Empty in case of Regular users.
function deleteuser($user, $owner) Delete a User Admin/Reseller string $user Username to delete
string $owner (Optional) Owner of the User.
function edituser($owner, $username, $uid, $gid, $num_user) Edit User Admin/Reseller string $owner Owner of the user
string $username Username to Edit
string $uid UID of the user
string $gid GID of the user
int $num_user Number of Users to edit, empty in case of Regular users.

Enduser Functions

Initializing

include_once('enterprise_sdk.php');

$rsdk = new Enterprise_API($url, $api_key, $api_pass);

This will load the Class in $rsdk with the paramaters:

Parameters :

  • $url is the login URL to access the Softaculous Enterprise Enduser Panel.
  • $api_key is the API KEY provided by Softaculous Installer or your Host to login to the Enterprise Enduser Panel.
  • $api_pass - is the API PASSWORD provided by Softaculous Installer or your Host with API KEY to login to the Enterprise Enduser Panel.

These parameters are required for authentication, as without authentication you will not be able to access Softaculous Enterprise.

Example
include_once('enterprise_sdk.php');

$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');

Session Tokens

function createSession($username, $owner = '', $ip_address = '')
  • Create a SESSION of a USER to enable the user to USE the Softaculous GUI Interface.

Parameters :

  • $username The username for the user you want to create a session
  • $owner The owner who owns the account of user. By default it is root.
  • $ip_address IP address where created session will be allowed.


Return Values :

$resp Will contain a KEY 'rsid' with the session ID which can be used to redirect the user to $url.'?rsid='.$resp['rsid'];

Example
include_once('enterprise_sdk.php');

$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');

$res = $rsdk->createSession('root', 'root', '192.168.17.131');

// Error
if(!empty($res['error'])){
	
	if(!empty($res['error'])){
		$rsdk->r_print($res['error']);
	}

// No error
}else{
	$rsdk->r_print($res);
}

Output will be:

Array
(
    [rsid] => itcqztcgbu8ngnqadiwsg3m98o0zrlcf
    [redirect_url] => http://192.168.17.131/?rsid=itcqztcgbu8ngnqadiwsg3m98o0zrlcf
)

Admin Functions

Initializing Admin panel

Note : The below functions are for the Softaculous Admin panel and hence you will have to initialize the admin panel. The port for Softaculous Admin panel is 2006

$rsdk = new Enterprise_API($url, $api_key, $api_pass);

This will load the Class in $rsdk with the paramaters:

  • $url is the login URL to access the Softaculous Enterprise Admin Panel.
  • $api_key is the Enterprise API KEY provided by Softaculous Installer or your Host to login to the Enterprise Admin Panel.
  • $api_pass - is the Enterprise API PASSWORD provided by Softaculous Installer or your Host with API KEY to login to the Enterprise Admin Panel.

These parameters are required for authentication, as without authentication you will not be able to access Softaculous Enterprise.

Example
include_once('enterprise_sdk.php');

$rsdk = new Enterprise_API('http://192.168.17.132', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');

Switch User

function switchUser($username = '', $owner = '')
  • This function is only for API. This function helps you to switch between the users.
  • Suppose you are a Admin and if you want to install a script for a user. You can login from your own details and use this function in between to switch to your user.
  • Only Admins and Resellers can use this function.

Parameters :

  • $username The username for the user the Admin/Reseller want to switch to.
  • $owner The owner who owns the account of user. By default it is root.

Return Values : NULL

Example

In the following example root is logged in first with its API_KEY and API_PASS, then he switches to user abc. After switching, wordpress is installed as the user abc. Install function is explained in Softaculous SDK.
Similarly Admin/Reseller can perform tasks on behalf of their users.
Note : Once you have switched to the user level then you cannot switch back to Admin/Reseller. You will have to login again.

$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // root details

$res = $rsdk->switchUser('abc');

$data['softdomain'] = 'domain.com'; // OPTIONAL - By Default the primary domain will be used
$data['softdirectory'] = 'wp222'; // OPTIONAL - By default it will be installed in the /public_html folder
$data['admin_pass'] = 'pass';
$data['admin_email'] = 'admin@domain.com';
$data['softdb'] = 'wp222';
$data['dbusername'] = 'wp222';
$data['dbuserpass'] = 'wp222';
$data['site_name'] = 'Wordpess wp222';
$data['admin_username'] = 'admin';
$data['language'] = 'en';
$data['site_desc'] = 'WordPress API Test';

$res = $rsdk->install(26, $data); // 26 is the SCRIPT ID for Wordpress
$res = unserialize($res);
if(!empty($res['done'])){
	echo 'Installed';
}else{
	echo 'Installation Failed<br/>';
	if(!empty($res['error'])){
		print_r($res['error']);
	}
}

List Domains

function list_domains()
  • This function has no parameters, it will get you the list of domains.
Example
$rsdk = new Enterprise_API('http://192.168.17.132:2006', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');
$result = $rsdk->list_domains();
print_r($result);
  • Will give you the output :
Array
(
    [title] => List Domains
    [domain_list] => Array
        (
            [domain.com] => Array
                (
                    [did] => 4
                    [owner] => root
                    [username] => root
                    [domain] => domain.com
                    [ftp_user] => user
                    [ftp_pass] => password
                    [ftp_path] => /public_html
                    [path] => /home/user/public_html
                    [backup_dir] => /backups
                )

        )

    [timenow] => 1361009593
    [time_taken] => 0.016
.
.
.
  • In the above output, domains_list provides the list of domains. You can iterate through domains_list to perform actions.

Add a Domain

function add_domain($domain, $username, $path, $backup_dir, $replace_path, $data_dir)
  • This function will allow you to ADD a domain.

Parameters :

  • $domain is the domain to be added
  • $username is the username of the User.
  • $path is the web accessible folder/path where your installations will be made. It should be accessible by Softaculous over NFS. Web accessible directory should be owned by user specified. e.g '/NFS/a/home/user/public_html'
  • $backup_dir is the Backup Directory. Softaculous will create backups in this folder. This should be accessible by Softaculous over NFS.

e.g '/NFS/a/home/user/backups'

  • $replace_path This "Replace Path" will be replaced with empty in PATH to get the correct path according to scripts. According to the scripts PATH mentioned above is not correct as we are on NFS. We have to generate a new path with respect to scripts.

e.g Wordpress needs to be installed on /var/www/html/wp on a server. On NFS for Softaculous /var/www/html is mounted at a directory say /NFS/a/var/www/html. So now for Softaculous, wordpress path is /NFS/a/var/www/html/wp. But Softaculous requires /var/www/html/wp so /NFS/a/var/www/html/wp is converted to /var/www/html/wp by removing /NFS/a. Here /NFS/a is Replace Path.

  • $data_dir Full path of the Data Directory. Some scripts like Elgg, Moodle, etc need a non web accessible folder. Specify accordingly that it can be accessed by Softaculous too which is on NFS.


Return Values :

  • Result will be in array.
  • The result is stored in $result and if the domain was added successfully,
    • $result['done'] should be 1.
    • $result['error'] should be empty.
  • If the domain was not added successfully,
    • $result['done'] should be 0.
    • $result['error'] should be an array with error message.


Example
$rsdk = new Enterprise_API('http://192.168.17.132:2006', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');

// Add the Domain
$res = $rsdk->adddomain('domain.com', 'user', '/NFS/home/public_html', '/NFS/home/salman/public_html/bakupdir', '/NFS', '/NFS/home/salman/datadir');

// Error
if(!empty($res['error'])){
	
	print_r($res['error']);

// No error
}else{
        // $res['done'] will be TRUE
	print_r($res);
}
  • The output of code above in case of success will be :
Array
(
    [title] => Add a Domain
    [done] => 1
    [timenow] => 1361009724
    [time_taken] => 6.730
)
  • The value of $res['error'] in case of failure will be :
Array
(
    [alreay_exists] => The submitted domain already exists in your account.
)

Delete a Domain

function delete_domain($domain, $delowner, $deluser)
  • This function will allow you to Delete a domain.

Parameters :

  • $domain is the domain to be DELETED
  • $delowner is the owner of the user (By default it is root.)
  • $deluser is the user of the domain

Return Values :

  • Result will be in array.
  • The result is stored in $result and if domain was deleted successfully,
    • $result['done'] should be 1.
    • $result['error'] should be empty.
  • If domain was not deleted successfully,
    • $result['done'] should be 0.
    • $result['error'] should be an array with error message.
Example
$rsdk = new Enterprise_API('http://192.168.17.132:2006', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');

$res = $rsdk->delete_domain('domain.com', 'root', 'abc');

// Error
if(!empty($res['error'])){
	
	print_r($res['error']);

// No error
}else{
	// $res['done'] will be TRUE
	print_r($res);
}
  • The output of code above in case of success will be :
Array
(
    [title] => List Domains
    [done] => 1
    [domain_list] => Array
        (
            [domain1.com] => Array
                (
                    [did] => 5
                    [owner] => root
                    [username] => root
                    [domain] => domain1.com
                    [ftp_user] => user1
                    [ftp_pass] => password1
                    [ftp_path] => /public_html
                    [path] => /home/user1/public_html
                    [backup_dir] => /backups
                )

        )

    [timenow] => 1361009970
    [time_taken] => 0.038
)
  • The value of $res['error'] in case of failure will be :
Array
(
    [no_domain] => Domain does not exist
)

List Users

function list_users()
  • This function has no parameters, it will get you the list of users.
Example
$rsdk = new Enterprise_API('http://192.168.17.132:2006', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');
$result = $rsdk->listusers();
print_r($result);
  • Will give you the output :
Array
(
    [title] => Softaculous - List User
    [error] => 
    [listusers] => Array
        (
            [owner_user] => Array
                (
                    [uid] => 3
                    [owner] => owner
                    [username] => user
                    [email] => 
                    [num_users] => 0
                    [disable_all_notify_update] => 0
                )

            [owner1_user1] => Array
                (
                    [uid] => 4
                    [owner] => owner1
                    [username] => user1
                    [email] => 
                    [num_users] => 0
                    [disable_all_notify_update] => 0
                )

            [owner2_owner2] => Array
                (
                    [uid] => 4
                    [owner] => owner2
                    [username] => owner2
                    [email] => 
                    [num_users] => 2
                    [disable_all_notify_update] => 0
                )

            [root_root] => Array
                (
                    [uid] => 4
                    [owner] => root
                    [username] => root
                    [email] => 
                    [num_users] => 0
                    [disable_all_notify_update] => 0
                )

            [root_user2] => Array
                (
                    [uid] => 4
                    [owner] => root
                    [username] => user2
                    [email] => 
                    [num_users] => 0
                    [disable_all_notify_update] => 0
                )
.
.
.
  • In the above output, listusers provides the list of domains. You can iterate through listusers to perform actions.

Add a User

function adduser($username, $email, $uid, $gid, $num_users = 0)
  • This function will allow you to ADD a User. To add a Reseller, $num_users should be more than 1.

Parameters :

  • $username is the user name to be added
  • $email is the email of the user.
  • $uid UID of the user. It is used to change the owner of the directories extracted by Softaculous.
  • $gid GID of the user. If not specified UID is assumed.
  • $num_users (Optional) is the number of users reseller can add. It should be more than one. Empty in case of Regular users.


Return Values :

  • Result will be in array.
  • The array is stored in $result if the user was added successfully,
    • $result['done'] should be 1.
    • $result['error'] should be empty.
  • if the user was not added successfully,
    • $result['done'] should be 0.
    • $result['error'] should be an array with error message.
Example
$rsdk = new Enterprise_API('http://192.168.17.132:2006', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');

$res = $rsdk->adduser('username', 'your_email@domain.com', 15, 15);

// Error
if(!empty($res['error'])){
	
        print_r($res['error']);

// No error
}else{
	print_r($res);
}
  • The output of code above in case of success will be :
Array
(
    [title] => Softaculous - Add User
    [done] => 1
    [error] => 
    [timenow] => 1361016929
    [time_taken] => 0.116
)
  • The value in $result['error'] in case of failure will be :
Array
(
    [0] => The username is already in use
)

Edit a User

function edituser($username, $update_to_user, $owner, $uid, $gid, $num_user = 0)
  • This function will allow you to edit Number of Users allowed to a Reseller.

Parameters :

  • $owner is the owner of the user account (By default it is root).
  • $username is the user name to be edited.
  • $update_to_user is the user name to be set.
  • $uid UID of the user. It is used to change the owner of the directories extracted by Softaculous.
  • $gid GID of the user. If not specified UID is assumed.
  • $num_users (Optional) is the number of users reseller is to be allowed. It should be more than one. Empty in case of Regular users.


Return Values :

  • Result will be in array.
  • The result is stored in $result and the user was edited successful,
    • $result['done'] should be 1.
    • $result['error'] should be empty.
  • If the user was not edited successful,
    • $result['done'] should be 0.
    • $result['error'] should be an array with error message.
Example
$rsdk = new Enterprise_API('http://192.168.17.132:2006', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');

$res = $rsdk->edituser('Old_user', 'New_user', 'root', 15, 15);

// Error
if(!empty($res['error'])){
	
	$rsdk->r_print($res['error']);

// No error
}else{
	$rsdk->r_print($res);
}
  • The output of code above in case of success will be :
Array
(
    [title] => Softaculous - List User
    [done] => 1
    [error] => 
.
.
.

Delete a User

function deleteuser($username, $owner)
  • This function will allow you to delete User.

Parameters :

  • $username is the user name to be delete
  • $owner is the owner of user.(Optional)


Return Values :

  • Result will be in array.
  • The result is stored in $result and if the user was deleted successfully,
    • $result['done'] should be 1.
    • $result['error'] should be empty.
  • If the user was not deleted successfully,
    • $result['done'] should be 0.
    • $result['error'] should be an array with error message.
Example
$rsdk = new Enterprise_API('http://192.168.17.132:2006', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd');

$res = $rsdk->deleteuser('username');

// Error
if(!empty($res['error'])){
	
	print_r($res['error']);

// No error
}else{
	print_r($res);
}
  • The output of code above in case of success will be :
Array
(
    [title] => Softaculous - List User
    [done] => 1
    [error] => 
.
.
.

General Functions

List Installed Script

  • This is to list all the scripts which are allowed to enduser to install. (Do not confuse with List Installations)
  • You can refer Softaculous List installed Script doc for the detailed explaination.
  • Below is the example of how to use List Installed Script API Function of Softaculous in Enterprise.
Example
$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // user details

$rsdk->list_installed_scripts();
print_r($rsdk->iscripts);

Install a Script

  • Installing a Script from Softaculous Enterprise.
  • You can refer Softaculous Install API doc for the detailed explaination.
  • Below is the example of how to use Install Function of Softaculous in Enterprise.
Example
include_once('enterprise_sdk.php');

$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // user details

$data['softdomain'] = 'domain.com'; // OPTIONAL - By Default the primary domain will be used
$data['softdirectory'] = 'wp222'; // OPTIONAL - By default it will be installed in the /public_html folder
$data['admin_pass'] = 'pass';
$data['admin_email'] = 'admin@domain.com';
$data['softdb'] = 'wp222'; // Database Username and Password will be created with the same "softdb" value.
$data['site_name'] = 'Wordpess wp222';
$data['admin_username'] = 'admin';
$data['language'] = 'en';
$data['site_desc'] = 'WordPress API Test';

$res = $rsdk->install(26, $data); // 26 is the SCRIPT ID for Wordpress (Refer List Installed Script Function to get the list)
$res = unserialize($res);
if(!empty($res['done'])){
	echo 'Installed';
}else{
	echo 'Installation Failed<br/>';
	if(!empty($res['error'])){
		print_r($res['error']);
	}
}

Remove a Script

  • Removing a Script from Softaculous Enterprise.
  • You can refer Softaculous Remove API doc for the detailed explaination.
  • Below is the example of how to use Remove API Function of Softaculous in Enterprise.
Example
$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // user details

$res = $rsdk->remove('26_37054', $data); (26_37054 is the installation id which can be fetched from List Installations function)

$res = unserialize($res);
if(!empty($res['done'])){
	echo 'Removed';
}else{
	echo 'Removing Unsuccessful<br/>';
	print_r($res['error']);
}

Upgrade a Script

  • Upgrading a Script from Softaculous Enterprise.
  • You can refer Softaculous Upgrade API doc for the detailed explaination.
  • Below is the example of how to use Upgrade API Function of Softaculous in Enterprise.
Example
$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // user details

$data['softbranch'] = '382'; // Script ID of the script you want to upgrade. (Refer List Installed Script Function to get the list)

$res = $rsdk->upgrade('92_69417', $data);
$_res = unserialize($res);
	
if(!empty($_res['done'])){
	echo 'Upgraded';
}else{
        echo 'Upgrade Failed<br/>';
        print_r($res['error']);
}

if(!empty($_res['setupcontinue'])){
        echo $_res['setupcontinue'].' Please visit the following link to complete the upgrade process.';
}

Backup a Script

  • Taking a Backup of the Script from Softaculous Enterprise.
  • You can refer Softaculous Backup API doc for the detailed explaination.
  • Below is the example of how to use Backup API Function of Softaculous in Enterprise.
Example
$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // user details

$data['backup_dir'] = 1;

$data['backup_db'] = 1;

$data['backup_datadir'] = 0;

$data['backup_wwwdir'] = 0;

$res = $rsdk->backup('26_37054', $data);

$res = unserialize($res);
if(!empty($res['done'])){
	echo 'Backing up the installation.';
}else{
	echo 'Backup Failed<br/>';
	print_r($res['error']);
}

Restore a Script

  • Restoring a Script from the Backup created using Softaculous Enterprise.
  • You can refer Softaculous Restore API doc for the detailed explaination.
  • Below is the example of how to use Restore API Function of Softaculous in Enterprise.
Example
$rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // user details

$data['restore_dir'] = 1;
$data['restore_db'] = 1;
$data['restore_datadir'] = 0;
$data['restore_wwwdir'] = 0;

// wp.26_60832.2012-07-26_10-13-33.zip is the Backup Name. Refer Backup List Function
$res = $rsdk->restore('wp.26_60832.2012-07-26_10-13-33.zip', $data); 

$res = unserialize($res);
if(!empty($res['done'])){
	echo 'Restored';
}else{
	echo 'Restoration Failed<br/>';
	print_r($res['error']);
}

Support

You can always ask us if you have any queries. The support department can be accessed from here : https://www.softaculous.net/support/