### Install a Script Example Source: https://www.softaculous.com/docs/admin/softaculous-enterprise-integration Example usage of the install method to deploy a new script instance. ```php 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
'; if(!empty($res['error'])){ print_r($res['error']); } } ``` -------------------------------- ### Example: Upgrade Installation with Softaculous SDK Source: https://www.softaculous.com/docs/admin/sdk This example demonstrates how to instantiate the SDK, set login credentials, specify the target script branch for upgrade, and process the upgrade result. It checks for successful upgrade, errors, and if further setup is required. ```php $new = new Softaculous_SDK(); $new->login = 'https://username:password@domain.com:2083/frontend/paper_lantern/softaculous/index.live.php'; $data['softbranch'] = '382'; // Script ID of the script you want to upgrade. $res = $new->upgrade('92_69417', $data); $_res = unserialize($res); if(!empty($_res['done'])){ echo 'Upgraded'; }else{ echo 'Upgrade Failed
'; print_r($res['error']); } if(!empty($_res['setupcontinue'])){ echo $_res['setupcontinue'].' Please visit the following link to complete the upgrade process.'; } ``` -------------------------------- ### Example Output of Listing Installations Source: https://www.softaculous.com/docs/cli/upgrade-script-from-cli This is an example output from the command to list user installations. The 'Installation ID' is crucial for initiating the upgrade process. ```text root@cpanel [~]# /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php -u --user=soft --list=1 Installations for Script : PmWiki | Installation ID | Script Name | Version | Installation URL | | 43_16546 | PmWiki | 2.2.42 | http://domain.com/pmwiki12 | | 43_20914 | PmWiki | 2.2.42 | http://domain.com/pmwiki13 | | 43_96782 | PmWiki | 2.2.42 | http://domain.com/pmwiki14 | | 43_54831 | PmWiki | 2.2.42 | http://domain.com/pmwiki16 | | 43_61730 | PmWiki | 2.2.42 | http://domain.com/pmwiki17 | | 43_28349 | PmWiki | 2.2.42 | http://domain.com/pmwiki18 | root@cpanel [~]# ``` -------------------------------- ### Example: Install WordPress using Softaculous SDK Source: https://www.softaculous.com/docs/admin/sdk This example demonstrates how to install WordPress using the Softaculous SDK. It shows how to set up the login URL and post data, then calls the install function and checks the result. ```php $new = new Softaculous_SDK(); $new->login = 'https://username:password@domain.com:2083/frontend/paper_lantern/softaculous/index.live.php'; // cPanel example Login $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 SDK Test'; $res = $new->install(26, $data); // 26 is the SCRIPT ID for WordPress $res = unserialize($res); if(!empty($res['done'])){ echo 'Installed'; }else{ echo 'Installation Failed
'; if(!empty($res['error'])){ print_r($res['error']); } } ``` -------------------------------- ### Install Set Source: https://www.softaculous.com/docs/api Examples for installing a set using CURL and PHP. ```CURL curl "https://user:password@domain.com:2083/frontend/jupiter/softaculous/index.live.php?act=manage_sets&softinstall_set=SET-NAME&softwebsites=26_35180&api=json" ``` ```PHP //The URL $url = 'https://user:password@domain.com:2083/frontend/jupiter/softaculous/index.live.php?'. '&api=serialize'. '&softinstall_set=SET-NAME'. '&softwebsites=26_35180'. '&act=manage_sets'; // 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']); } ``` -------------------------------- ### Auto Install API - Script Installation Example Source: https://www.softaculous.com/docs/api/auto-install-api This snippet demonstrates how to initialize the Softaculous API class and install a script, using WordPress as an example. It includes details on setting the login URL, domain, directory, admin credentials, and handling the installation response. ```APIDOC ## POST /api/install ### Description Automates the installation of scripts using the Softaculous API. ### Method POST ### Endpoint /api/install ### Parameters #### Request Body - **user** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. - **domain** (string) - Required - The domain where the script will be installed. - **script_id** (integer) - Required - The ID of the script to install (e.g., 26 for WordPress). - **softdirectory** (string) - Optional - The directory within the public_html folder for installation. - **admin_pass** (string) - Optional - The admin password for the installed application. - **admin_email** (string) - Optional - The admin email for the installed application. ### Request Example ```json { "user": "your_username", "password": "your_password", "domain": "yourdomain.com", "script_id": 26, "softdirectory": "my_app", "admin_pass": "secure_password", "admin_email": "admin@yourdomain.com" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the installation status ('installed' or error message). #### Response Example ```json { "status": "installed" } ``` #### Error Response (e.g., 500) - **error** (string) - A serialized array of errors if the installation fails. #### Error Response Example ```json { "error": "a:1:{i:0;s:25:\"Invalid domain name.\";}" } ``` ``` -------------------------------- ### Install a Script via Auto Install API Source: https://www.softaculous.com/docs/api/auto-install-api Example demonstrating the initialization of the Soft_Install class and the installation of a script (WordPress) using provided credentials and configuration data. ```php login = 'https://'.rawurlencode("user").':'.rawurlencode("password").'@domain.com:2083/frontend/jupiter/softaculous/index.live.php'; $new->data['softdomain'] = 'domain.com'; // OPTIONAL - By Default the primary domain will be used $new->data['softdirectory'] = 'folder'; // OPTIONAL - By default it will be installed in the /public_html folder $new->data['admin_pass'] = 'qwerty'; $new->data['admin_email'] = 'admin@domain.com'; $res = $new->install(26); // Will install WordPress if($res == 'installed'){ echo 'Installed'; }else{ echo $res; // A serialized array of error will be returned } ``` -------------------------------- ### List Installations in JSON Format Source: https://www.softaculous.com/docs/cli/list-installations-from-cli Example command to retrieve installation data in JSON format using the --resp parameter. ```bash /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php --list_ins --user=USER --resp=json ``` -------------------------------- ### List Installed Scripts Example Source: https://www.softaculous.com/docs/admin/softaculous-enterprise-integration Example usage of the list_installed_scripts method to retrieve available scripts. ```php $rsdk = new Enterprise_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // user details $rsdk->list_installed_scripts(); print_r($rsdk->iscripts); ``` -------------------------------- ### Import an Installation Source: https://www.softaculous.com/docs/admin/softaculous-enterprise-integration This example demonstrates how to import an existing installation into Softaculous. ```APIDOC ## POST /index.php ### Description Imports an existing installation into Softaculous. ### Method POST ### Endpoint `http://your.softaculous.com/index.php` ### Query Parameters - **api_key** (string) - Required - Your Softaculous API key. - **api_pass** (string) - Required - Your Softaculous API password. - **api** (string) - Required - Set to 'serialize' for serialized responses. - **act** (string) - Required - Set to 'import' to import an installation. - **soft** (integer) - Required - The ID of the script to import. ### Request Body - **softsubmit** (integer) - Required - Set to '1' to submit the import request. - **softdomain** (string) - Required - The domain of the installation to import. - **softdirectory** (string) - Optional - The directory of the installation. Leave empty for the web root. ### Request Example ```json { "softsubmit": 1, "softdomain": "example.com", "softdirectory": "wp" } ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### Install Set using Softaculous API Source: https://www.softaculous.com/docs/api/remote-api Use this example to install a specific set of software. Ensure your API credentials and set name are correctly configured. The response is returned in PHP serialized format. ```php //The URL $url = 'http://your.softaculous.com/index.php?'. 'api_key=TESTAPIKEY'. '&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'. '&api=serialize'. '&softinstall_set=SET-NAME'. '&softwebsites=26_35180'. '&act=manage_sets'; // 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']); } ``` -------------------------------- ### Upgrade Script with Remote API Source: https://www.softaculous.com/docs/admin/softaculous-remote Use this example to upgrade a script installation. You need to provide the installation ID and the script branch ID. The result is unserialized to check for success, failure, or if further setup is required. ```php $rsdk = new Remote_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
'; print_r($res['error']); } if(!empty($_res['setupcontinue'])){ echo $_res['setupcontinue'].' Please visit the following link to complete the upgrade process.'; } ``` -------------------------------- ### Perform Quick Installation via CLI Source: https://www.softaculous.com/docs/admin/installing-softaculous-in-interworx Use the --quick flag to initiate the installation and download script packages in the background. ```bash wget -O install.sh https://files.softaculous.com/install.sh chmod 755 install.sh ./install.sh --quick ``` -------------------------------- ### Example Output of List Installations Source: https://www.softaculous.com/docs/cli/upgrade-script-from-cli This is an example of the output generated when listing installations using the Softaculous CLI. It displays Installation ID, Script Name, Version, and URL. ```text soft@cpanel [~]$ /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php -u --list=1 Installations for Script : PmWiki | Installation ID | Script Name | Version | Installation URL | | 43_16546 | PmWiki | 2.2.42 | http://domain.com/pmwiki12 | | 43_20914 | PmWiki | 2.2.42 | http://domain.com/pmwiki13 | | 43_96782 | PmWiki | 2.2.42 | http://domain.com/pmwiki14 | | 43_54831 | PmWiki | 2.2.42 | http://domain.com/pmwiki16 | | 43_61730 | PmWiki | 2.2.42 | http://domain.com/pmwiki17 | | 43_28349 | PmWiki | 2.2.42 | http://domain.com/pmwiki18 | soft@cpanel [~]$ ``` -------------------------------- ### Import From Other Installer Source: https://www.softaculous.com/docs/api Fetches a list of installations from other installers via a GET request. ```CURL curl "https://user:password@domain.com:2083/frontend/jupiter/softaculous/index.live.php?act=sync&api=json" ``` -------------------------------- ### List Real Version (Admin Panel) Source: https://www.softaculous.com/docs/api/remote-api This example demonstrates how to list installations and specifically request only the real version information. It requires API credentials. ```php // 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); }else{ echo 'Some error occured'; print_r($res['error']); } ``` -------------------------------- ### Edit Installation Details Source: https://www.softaculous.com/docs/api/api Updates existing installation configurations using cURL. The PHP example uses serialized responses, while the CLI example uses JSON. ```bash curl -d "editins=1" -d "edit_dir=/path/to/installation/" -d "edit_url=http://example.com" -d "edit_dbname=wpdb" -d "edit_dbuser=dbusername" -d "edit_dbpass=dbuserpass" -d "edit_dbhost=dbhost" -d "admin_username=adminusername" -d "admin_pass=adminpassword" "https://user:password@domain.com:2083/frontend/jupiter/softaculous/index.live.php?act=editdetail&insid=26_12345&api=json" ``` ```PHP // The URL $url = 'https://user:password@domain.com:2083/frontend/jupiter/softaculous/index.live.php?'. '&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', 'admin_username' => 'adminusername', //Provide this only if script provides as well as password needs to be reset 'admin_pass' => 'adminpassword' //Provide this only if script provides ); // 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); ``` -------------------------------- ### Pre-Install Hook Example Source: https://www.softaculous.com/docs/admin/hooks This hook executes before a script is installed. Rename the .txt file to .php and add your custom code. ```php // Rename pre_install.txt to pre_install.php and add your code here ``` -------------------------------- ### Quick Installation Command Source: https://www.softaculous.com/docs/admin/installing-softaculous-in-hosting-controller Executes the installer with the --quick flag to download script packages in the background. ```bash "path\to\php.exe" "path\to\installer.php" --quick ``` -------------------------------- ### List Installations by Installation ID Source: https://www.softaculous.com/docs/cli/list-installations-from-cli Use the --insid parameter to list details of a specific installation. For example, --insid=26_55678. ```bash /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php --list_ins --user=USER --insid=26_55678 ``` -------------------------------- ### Post-Install Hook Example Source: https://www.softaculous.com/docs/admin/hooks This hook executes immediately after a script is installed. Rename the .txt file to .php and add your custom code. ```php // Rename post_install.txt to post_install.php and add your code here ``` -------------------------------- ### GET /launch/index.php Source: https://www.softaculous.com/docs/softaculous-cloud/plugins-themes-demos-using-template Launches a demo website installation based on a template. This endpoint supports both public and private (authenticated) access. ```APIDOC ## GET /launch/index.php ### Description Launches a demo website installation. The API returns the website URL and an auto-login URL for the admin dashboard. ### Method GET ### Endpoint https://cloud.softaculous.com/launch/index.php ### Parameters #### Query Parameters - **u** (string) - Required - User ID - **t** (string) - Required - Template ID - **api** (string) - Required - Set to 'json' to receive JSON response - **api_key** (string) - Optional - API key for private templates - **api_pass** (string) - Optional - API password for private templates ### Response #### Success Response (200) - **done** (integer) - Indicates the launch was successful - **softurl** (string) - The URL of the demo website - **auto_login_url** (string) - The URL to auto-login to the admin panel #### Response Example { "done": 1, "softurl": "https://u12345.softaculous.dev/wpZ9ZOkCj", "auto_login_url": "https://u12345.softaculous.dev/wpZ9ZOkCj/sapp-wp-signon.php?pass=t6wgd6wrkt09e1ia6y5a2hjymhyfnj9v" } ``` -------------------------------- ### List Installations by Installation ID (Duplicate) Source: https://www.softaculous.com/docs/cli/list-installations-from-cli Use the --insid parameter to list details of a specific installation. For example, --insid=26_55678. ```bash /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php --list_ins --insid=26_55678 ``` -------------------------------- ### Synchronize Installations (PHP with POST data) Source: https://www.softaculous.com/docs/api This PHP code snippet demonstrates synchronizing installations by constructing a POST request with installation keys. It uses `http_build_query` to format the data for the API. ```php //The URL $url = 'https://user:password@domain.com:2083/frontend/jupiter/softaculous/index.live.php?'. '&api=serialize'. '&act=sync'; $post = array( 'softsubmit' => 1, 'approved' => array('cbpny97zd5kcsk4coo8gws084','dxw755lmeb4s4cw40o8o8kk44')); // 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); $res = unserialize($resp); print_r($res); ``` -------------------------------- ### Switch User and Install Script Source: https://www.softaculous.com/docs/admin/installing-softaculous-remote Demonstrates switching to a specific user and then installing a script (WordPress in this case) on behalf of that user. Requires admin or reseller privileges. Note that after switching, you cannot switch back to admin/reseller without re-logging in. ```php include_once('remote_sdk.php'); $rsdk = new Remote_API('http://192.168.17.132', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); // Admin 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
'; if(!empty($res['error'])){ print_r($res['error']); } } ``` -------------------------------- ### Remove an Installed Script Source: https://www.softaculous.com/docs/admin/softaculous-enterprise-integration This example shows how to remove an installed script using the Softaculous API. ```APIDOC ## POST /index.php ### Description Removes an installed script. ### Method POST ### Endpoint `http://your.softaculous.com/index.php` ### Query Parameters - **api_key** (string) - Required - Your Softaculous API key. - **api_pass** (string) - Required - Your Softaculous API password. - **api** (string) - Required - Set to 'serialize' for serialized responses. - **act** (string) - Required - Set to 'remove' to remove an installation. - **insid** (integer) - Required - The ID of the installation to remove. ### Request Body - **removeins** (integer) - Required - Set to '1' to confirm removal. - **remove_dir** (integer) - Optional - Set to '1' to remove the installation directory. - **remove_datadir** (integer) - Optional - Set to '1' to remove the data directory. - **remove_db** (integer) - Optional - Set to '1' to remove the database. - **remove_dbuser** (integer) - Optional - Set to '1' to remove the database user. ### Request Example ```json { "removeins": "1", "remove_dir": "1", "remove_datadir": "1", "remove_db": "1", "remove_dbuser": "1" } ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### Get Installations Count Source: https://www.softaculous.com/docs/cli/list-installations-from-cli Pass the --count=1 parameter to retrieve only the total count of installations. ```bash /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php --list_ins --user=USER --count=1 ``` -------------------------------- ### Push Installation to Live via PHP Source: https://www.softaculous.com/docs/api/enterprise-api Initiates a push-to-live process for a specific installation ID. Requires a valid API key and password. ```php // URL $url = 'http://your.softaculous.com/index.php?'. 'api_key=TESTAPIKEY'. '&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'. '&api=serialize'. '&act=pushtolive'. '&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'])){ echo 'Push to live succesfully started in background. Use the Task key '.$res['done'].' to get the current status of the push to live process.'; // Error }else{ echo 'Some error occured'; print_r($res['error']); } // Print the entire output just incase ! print_r($res); ``` -------------------------------- ### Submit Installation Data Fields Source: https://www.softaculous.com/docs/api/auto-install-api Define installation parameters such as domain, directory, and admin credentials before triggering the installation process. ```php $new->data['softdomain'] = 'domain.com'; // OPTIONAL - By Default the primary domain will be used $new->data['softdirectory'] = 'folder'; // OPTIONAL - By default it will be installed in the /public_html folder $new->data['admin_pass'] = 'qwerty'; $new->data['admin_email'] = 'admin@domain.com'; $res = $new->install(26); // Will install WordPress ``` -------------------------------- ### Clone an Installed Script Source: https://www.softaculous.com/docs/admin/softaculous-enterprise-integration This example demonstrates how to clone an existing script installation using the Softaculous API. ```APIDOC ## POST /index.php ### Description Clones an existing script installation. ### Method POST ### Endpoint `http://your.softaculous.com/index.php` ### Query Parameters - **api_key** (string) - Required - Your Softaculous API key. - **api_pass** (string) - Required - Your Softaculous API password. - **api** (string) - Required - Set to 'serialize' for serialized responses. - **act** (string) - Required - Set to 'sclone' for cloning. - **insid** (integer) - Required - The ID of the installation to clone. ### Request Body - **softsubmit** (integer) - Required - Set to '1' to submit the clone request. - **softdomain** (string) - Required - The domain where the installation will be cloned. - **softdirectory** (string) - Optional - The directory for the installation. Leave empty for the web root. - **softdb** (string) - Required - The database name for the new installation. ### Request Example ```json { "softsubmit": "1", "softdomain": "example.com", "softdirectory": "wp", "softdb": "wpdb" } ``` ### Response #### Success Response (200) - **done** (integer) - Indicates successful cloning. - **__settings** (object) - Contains settings for the cloned installation, including **softurl**. #### Response Example ```json { "done": 1, "__settings": { "softurl": "http://example.com/wp" } } ``` ``` -------------------------------- ### Get Installations Count (Duplicate) Source: https://www.softaculous.com/docs/cli/list-installations-from-cli Pass the --count=1 parameter to retrieve only the total count of installations. ```bash /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php --list_ins --count=1 ``` -------------------------------- ### Install a Script Source: https://www.softaculous.com/docs/admin/installing-softaculous-remote Install a script by providing configuration data to the install method. The response must be unserialized to check the 'done' status. ```php include_once('remote_sdk.php'); $rsdk = new Remote_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'; $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 (Refer List Installed Script Function to get the list) $res = unserialize($res); if(!empty($res['done'])){ echo 'Installed'; }else{ echo 'Installation Failed
'; if(!empty($res['error'])){ print_r($res['error']); } } ``` -------------------------------- ### Script Management - List Installed Scripts Source: https://www.softaculous.com/docs/developers/softaculous-remote This function lists all scripts available for end-users to install. It provides an example of how to retrieve this list. ```APIDOC ## GET /scripts/installed ### Description Lists all scripts that are available for end-users to install. ### Method GET ### Endpoint /scripts/installed ### Parameters None ### Request Example ```php $rsdk = new Remote_API('http://192.168.17.131', 'pirrehjhzrkgwztr', 'odxzhipr4nhntkrcx1zjvf4cxysgaffd'); $rsdk->list_installed_scripts(); print_r($rsdk->iscripts); ``` ### Response #### Success Response (200) - **iscripts** (array) - An array containing details of installed scripts. ``` -------------------------------- ### POST /index.live.php?act=sync Source: https://www.softaculous.com/docs/api/api Synchronizes or bulk imports manual installations. ```APIDOC ## POST /index.live.php?act=sync ### Description Synchronizes manual installations or fetches a list of installations from other installers. ### Method POST ### Endpoint /frontend/jupiter/softaculous/index.live.php?act=sync ### Parameters #### Query Parameters - **api** (string) - Required - The API format (e.g., json) - **act** (string) - Required - The action to perform (sync) #### Request Body - **import_all** (integer) - Optional - Set to 1 to import all detected manual installations ``` -------------------------------- ### Install WordPress as a User Source: https://www.softaculous.com/docs/admin/softaculous-enterprise-integration Logs in as root, switches to user 'abc', and then installs WordPress for that user. Ensure all required parameters for installation are provided. ```php $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
'; if(!empty($res['error'])){ print_r($res['error']); } } ``` -------------------------------- ### Admin Login Example Source: https://www.softaculous.com/docs/api/remote-api This example demonstrates how to authenticate as an administrator using API credentials. Ensure your API key and secret are correctly configured. ```php $url = 'http://remote.softaculous.com/index.php?'. 'api_key=TESTAPIKEYREMOTE'. '&api_pass=PASSPASSPASSPASSPASSPASSPASSPASS'. '&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); ``` -------------------------------- ### GET /list_installed_scripts Source: https://www.softaculous.com/docs/developers/softaculous-enterprise-integration Lists all scripts available for the end-user to install. ```APIDOC ## GET /list_installed_scripts ### Description Retrieves a list of all scripts that the end-user is permitted to install. ``` -------------------------------- ### Initialize and Authenticate API Source: https://www.softaculous.com/docs/api/auto-install-api Initializes the Soft_Install class and sets the login URL required for authentication. ```php $new = new Soft_Install(); $new->login = 'https://'.rawurlencode("user").':'.rawurlencode("password").'@domain.com:2083/frontend/jupiter/softaculous/index.live.php'; ``` -------------------------------- ### GET /index.php?act=home Source: https://www.softaculous.com/docs/api/enterprise-api Lists installed scripts for an end-user. ```APIDOC ## GET /index.php?act=home ### Description Retrieves the list of installed scripts for the authenticated user. ### Method GET ### Endpoint http://your.softaculous.com/index.php ### Query Parameters - **act** (string) - Required - Set to 'home' - **api** (string) - Required - Set to 'serialize' ``` -------------------------------- ### Handle Installation Return Values Source: https://www.softaculous.com/docs/api/auto-install-api Check the installation result to confirm success or retrieve a serialized array of error details. ```php if($res == 'installed'){ echo 'Installed'; }else{ echo $res; // A serialized array of error will be returned } ```