[ // set some SSL/TLS specific options 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ]); //* Create the SOAP client connection $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1, 'stream_context' => $context)); try { //* Login as remote user if($session_id = $client->login($soap_username, $soap_password)) { echo "Login successfull\n"; echo "Session ID: ".$session_id."\n"; } //* Set the function parameters $client_id = 0; $params = array( 'server_id' => 1, 'client_id' => 0, 'ip_type' => 'IPv4', 'ip_address' => $server_ipv4_tor, 'virtualhost' => 'y', 'virtualhost_port' => '80,443' ); //* Add the Tor IP $local_ip_id = $client->server_ip_add($session_id, $client_id, $params); //* Print the results echo "Tor IP ID: ".$local_ip_id."\n"; //* Set the function parameters $reseller_id = 0; // this id has to be 0 if the client shall not be assigned to admin or if the client is a reseller $params = array( 'company_name' => $client_company_name, 'contact_name' => $client_contact_name, 'customer_no' => '', 'vat_id' => '', 'street' => '', 'zip' => '', 'city' => '', 'state' => '', 'country' => 'US', 'telephone' => '', 'mobile' => '', 'fax' => '', 'email' => $client_email, 'internet' => $client_company_url, 'icq' => '', 'notes' => 'awesome', 'default_mailserver' => 1, 'limit_maildomain' => 0, 'limit_mailbox' => 0, 'limit_mailalias' => 0, 'limit_mailaliasdomain' => 0, 'limit_mailforward' => 0, 'limit_mailcatchall' => 0, 'limit_mailrouting' => 0, 'limit_mail_wblist' => 0, 'limit_mailfilter' => 0, 'limit_fetchmail' => 0, 'limit_mailquota' => 0, 'limit_spamfilter_wblist' => 0, 'limit_spamfilter_user' => 0, 'limit_spamfilter_policy' => 1, 'default_webserver' => 1, 'limit_web_ip' => '', 'limit_web_domain' => 0, 'limit_web_quota' => 0, 'web_php_options' => 'no', 'limit_web_subdomain' => 0, 'limit_web_aliasdomain' => 0, 'limit_ftp_user' => 0, 'limit_shell_user' => 0, 'ssh_chroot' => 'no', 'limit_webdav_user' => 0, 'default_dnsserver' => 1, 'limit_dns_zone' => 0, 'limit_dns_slave_zone' => 0, 'limit_dns_record' => 0, 'default_dbserver' => 1, 'limit_database' => 0, 'limit_cron' => 0, 'limit_cron_type' => 'url', 'limit_cron_frequency' => 5, 'limit_traffic_quota' => 0, 'limit_client' => 0, // If this value is > 0, then the client is a reseller 'parent_client_id' => 0, 'username' => $client_username, 'password' => $client_password, 'language' => 'en', 'usertheme' => 'default', 'template_master' => $client_template_master, 'template_additional' => $client_template_additional, 'created_at' => 0 ); //* Add the client $client_ispc_id = $client->client_add($session_id, $reseller_id, $params); //* Print the results echo "Client ID: ".$client_ispc_id."\n"; //* Set the function parameters. $primary_id = -1; //* Get the IP array $record_record = $client->server_ip_get($session_id, $primary_id); //* Loop through the results foreach ($record_record as $key => $val) { //* Check if the IP matches if ($val['ip_address'] == $server_ipv6) { //* Set the function parameters. $client_id = 0; $ip_id = $val['server_ip_id']; $params = array( 'server_id' => $val['server_id'], 'client_id' => $client_ispc_id, 'ip_type' => $val['ip_type'], 'ip_address' => $val['ip_address'], 'virtualhost' => 'y', 'virtualhost_port' => $val['virtualhost_port'] ); //* Update the IP $affected_rows = $client->server_ip_update($session_id, $client_id, $ip_id, $params); //* Print the results echo "IPv6 Affected Rows: ".$affected_rows."\n"; } if ($val['ip_address'] == $server_ipv4) { //* Set the function parameters. $client_id = 0; $ip_id = $val['server_ip_id']; $params = array( 'server_id' => $val['server_id'], 'client_id' => $val['client_id'], 'ip_type' => $val['ip_type'], 'ip_address' => $val['ip_address'], 'virtualhost' => 'y', 'virtualhost_port' => $val['virtualhost_port'] ); //* Update the IP $affected_rows = $client->server_ip_update($session_id, $client_id, $ip_id, $params); //* Print the results echo "Shared IPv4 Affected Rows: ".$affected_rows."\n"; } if ($val['ip_address'] == $server_ipv6_shared) { //* Set the function parameters. $client_id = 0; $ip_id = $val['server_ip_id']; $params = array( 'server_id' => $val['server_id'], 'client_id' => $val['client_id'], 'ip_type' => $val['ip_type'], 'ip_address' => $val['ip_address'], 'virtualhost' => 'y', 'virtualhost_port' => $val['virtualhost_port'] ); //* Update the IP $affected_rows = $client->server_ip_update($session_id, $client_id, $ip_id, $params); //* Print the results echo "Shared IPv6 Affected Rows: ".$affected_rows."\n"; } } //* Set the function parameters $client_id = $client_ispc_id; $template_id = 6; $domain = $server_hostname_full; $ip = $server_ipv4; $ns1 = 'ns1.'.$server_hostname_full; $ns2 = 'ns2.'.$server_hostname_full; $email = 'hostmaster@xev.net.eu.org'; $ipv6 = $server_ipv6; //* Add a DNS zone using a template $dns_zone_id = $client->dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email, $ipv6); //* Print the results echo "DNS Zone ID: ".$dns_zone_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'domain' => $server_hostname_full, 'active' => 'y' ); //* Add the mail domain $mail_domain_id = $client->mail_domain_add($session_id, $client_id, $params); //* Print the results echo "Mail Domain ID: ".$mail_domain_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'priority' => 5, 'policy_id' => 5, 'email' => "@".$server_hostname_full, 'fullname' => "@".$server_hostname_full, 'local' => 'Y' ); //* Add the mail spamfilter user $spamfilter_user_id = $client->mail_spamfilter_user_add($session_id, $client_id, $params); //* Print the results echo "Spamfilter User ID: ".$spamfilter_user_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'ip_address' => '127.0.0.1', 'ipv6_address' => '', 'domain' => '00000-defaultsite.tld', 'type' => 'vhost', 'parent_domain_id' => 0, 'vhost_type' => 'name', 'hd_quota' => 100, 'traffic_quota' => 10000, 'cgi' => 'y', 'ssi' => 'y', 'suexec' => 'y', 'errordocs' => 0, 'is_subdomainwww' => 1, 'subdomain' => 'www', 'php' => 'fast-cgi', 'server_php_id' => '', 'ruby' => 'n', 'perl' => 'n', 'python' => 'n', 'redirect_type' => '', 'redirect_path' => '', 'ssl' => 'y', 'ssl_letsencrypt' => 'n', 'ssl_state' => '', 'ssl_locality' => '', 'ssl_organisation' => 'Default Org', 'ssl_organisation_unit' => 'IT', 'ssl_country' => 'US', 'ssl_domain' => '00000-defaultsite.tld', 'ssl_request' => '', 'ssl_key' => '', 'ssl_cert' => '', 'ssl_bundle' => '', 'ssl_action' => 'create', 'stats_password' => '', 'stats_type' => 'webalizer', 'allow_override' => 'All', 'apache_directives' => '', 'php_open_basedir' => '/', 'php_fpm_use_socket' => 'y', 'pm' => 'ondemand', 'pm_max_children' => 10, 'pm_start_servers' => 2, 'pm_max_requests' => 0, 'pm_max_spare_servers' => 5, 'pm_process_idle_timeout' => 10, 'custom_php_ini' => '', 'backup_interval' => '', 'backup_copies' => 1, 'backup_format_web' => 'default', 'backup_format_db' => 'gzip', 'active' => 'y', 'traffic_quota_lock' => 'n', 'http_port' => '80', 'https_port' => '443', 'log_retention' => '10' ); //* Add a web domain $web_domain_id = $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false); //* Print the results echo "Web Domain ID: ".$web_domain_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'parent_domain_id' => $web_domain_id, 'username' => $client_username.$ftp_default1_username, 'username_prefix' => $client_username, 'password' => $ftp_default1_password, 'quota_size' => 100, 'active' => 'y', 'uid' => 'web'.$web_domain_id, 'gid' => 'client'.$client_id, 'dir' => '/var/www/clients/client'.$client_id.'/web'.$web_domain_id, 'quota_files' => -1, 'ul_ratio' => -1, 'dl_ratio' => -1, 'ul_bandwidth' => -1, 'dl_bandwidth' => -1 ); //* Add a FTP user $ftp_id = $client->sites_ftp_user_add($session_id, $client_id, $params); //* Print the results echo "FTP User ID: ".$ftp_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'ip_address' => $server_ipv4, 'ipv6_address' => '', 'domain' => '00001-defaultsite.tld', 'type' => 'vhost', 'parent_domain_id' => 0, 'vhost_type' => 'name', 'hd_quota' => 100, 'traffic_quota' => 10000, 'cgi' => 'y', 'ssi' => 'y', 'suexec' => 'y', 'errordocs' => 0, 'is_subdomainwww' => 1, 'subdomain' => 'www', 'php' => 'fast-cgi', 'server_php_id' => '', 'ruby' => 'n', 'perl' => 'n', 'python' => 'n', 'redirect_type' => '', 'redirect_path' => '', 'ssl' => 'y', 'ssl_letsencrypt' => 'n', 'ssl_state' => '', 'ssl_locality' => '', 'ssl_organisation' => 'Default Org', 'ssl_organisation_unit' => 'IT', 'ssl_country' => 'US', 'ssl_domain' => '00001-defaultsite.tld', 'ssl_request' => '', 'ssl_key' => '', 'ssl_cert' => '', 'ssl_bundle' => '', 'ssl_action' => 'create', 'stats_password' => '', 'stats_type' => 'webalizer', 'allow_override' => 'All', 'apache_directives' => '', 'php_open_basedir' => '/', 'php_fpm_use_socket' => 'y', 'pm' => 'ondemand', 'pm_max_children' => 10, 'pm_start_servers' => 2, 'pm_max_requests' => 0, 'pm_max_spare_servers' => 5, 'pm_process_idle_timeout' => 10, 'custom_php_ini' => '', 'backup_interval' => '', 'backup_copies' => 1, 'backup_format_web' => 'default', 'backup_format_db' => 'gzip', 'active' => 'y', 'traffic_quota_lock' => 'n', 'http_port' => '80', 'https_port' => '443', 'log_retention' => '10' ); //* Add a web domain $web_domain_id = $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false); //* Print the results echo "Web Domain ID: ".$web_domain_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'parent_domain_id' => $web_domain_id, 'username' => $client_username.$ftp_default2_username, 'username_prefix' => $client_username, 'password' => $ftp_default2_password, 'quota_size' => 100, 'active' => 'y', 'uid' => 'web'.$web_domain_id, 'gid' => 'client'.$client_id, 'dir' => '/var/www/clients/client'.$client_id.'/web'.$web_domain_id, 'quota_files' => -1, 'ul_ratio' => -1, 'dl_ratio' => -1, 'ul_bandwidth' => -1, 'dl_bandwidth' => -1 ); //* Add a FTP user $ftp_id = $client->sites_ftp_user_add($session_id, $client_id, $params); //* Print the results echo "FTP User ID: ".$ftp_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'ip_address' => '*', 'ipv6_address' => '', 'domain' => '00002-defaultsite.tld', 'type' => 'vhost', 'parent_domain_id' => 0, 'vhost_type' => 'name', 'hd_quota' => 100, 'traffic_quota' => 10000, 'cgi' => 'y', 'ssi' => 'y', 'suexec' => 'y', 'errordocs' => 0, 'is_subdomainwww' => 1, 'subdomain' => 'www', 'php' => 'fast-cgi', 'server_php_id' => '', 'ruby' => 'n', 'perl' => 'n', 'python' => 'n', 'redirect_type' => '', 'redirect_path' => '', 'ssl' => 'y', 'ssl_letsencrypt' => 'n', 'ssl_state' => '', 'ssl_locality' => '', 'ssl_organisation' => 'Default Org', 'ssl_organisation_unit' => 'IT', 'ssl_country' => 'US', 'ssl_domain' => '00002-defaultsite.tld', 'ssl_request' => '', 'ssl_key' => '', 'ssl_cert' => '', 'ssl_bundle' => '', 'ssl_action' => 'create', 'stats_password' => '', 'stats_type' => 'webalizer', 'allow_override' => 'All', 'apache_directives' => '', 'php_open_basedir' => '/', 'php_fpm_use_socket' => 'y', 'pm' => 'ondemand', 'pm_max_children' => 10, 'pm_start_servers' => 2, 'pm_max_requests' => 0, 'pm_max_spare_servers' => 5, 'pm_process_idle_timeout' => 10, 'custom_php_ini' => '', 'backup_interval' => '', 'backup_copies' => 1, 'backup_format_web' => 'default', 'backup_format_db' => 'gzip', 'active' => 'y', 'traffic_quota_lock' => 'n', 'http_port' => '80', 'https_port' => '443', 'log_retention' => '10' ); //* Add a web domain $web_domain_id = $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false); //* Print the results echo "Web Domain ID: ".$web_domain_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'parent_domain_id' => $web_domain_id, 'username' => $client_username.$ftp_default3_username, 'username_prefix' => $client_username, 'password' => $ftp_default3_password, 'quota_size' => 100, 'active' => 'y', 'uid' => 'web'.$web_domain_id, 'gid' => 'client'.$client_id, 'dir' => '/var/www/clients/client'.$client_id.'/web'.$web_domain_id, 'quota_files' => -1, 'ul_ratio' => -1, 'dl_ratio' => -1, 'ul_bandwidth' => -1, 'dl_bandwidth' => -1 ); //* Add a FTP user $ftp_id = $client->sites_ftp_user_add($session_id, $client_id, $params); //* Print the results echo "FTP User ID: ".$ftp_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'ip_address' => $server_ipv4, 'ipv6_address' => $server_ipv6, 'domain' => $server_hostname_full, 'type' => 'vhost', 'parent_domain_id' => 0, 'vhost_type' => 'name', 'hd_quota' => 100, 'traffic_quota' => 10000, 'cgi' => 'y', 'ssi' => 'y', 'suexec' => 'y', 'errordocs' => 0, 'is_subdomainwww' => 1, 'subdomain' => 'www', 'php' => 'fast-cgi', 'server_php_id' => '', 'ruby' => 'n', 'perl' => 'n', 'python' => 'n', 'redirect_type' => 'R=301,L', 'redirect_path' => 'https://'.$server_hostname_full.':8080/', 'ssl' => 'y', 'ssl_letsencrypt' => 'n', 'ssl_state' => '', 'ssl_locality' => '', 'ssl_organisation' => 'Default Org', 'ssl_organisation_unit' => 'IT', 'ssl_country' => 'US', 'ssl_domain' => $server_hostname_full, 'ssl_request' => '', 'ssl_key' => '', 'ssl_cert' => '', 'ssl_bundle' => '', 'ssl_action' => 'create', 'stats_password' => '', 'stats_type' => 'webalizer', 'allow_override' => 'All', 'apache_directives' => '', 'php_open_basedir' => '/', 'php_fpm_use_socket' => 'y', 'pm' => 'ondemand', 'pm_max_children' => 10, 'pm_start_servers' => 2, 'pm_max_requests' => 0, 'pm_max_spare_servers' => 5, 'pm_process_idle_timeout' => 10, 'custom_php_ini' => '', 'backup_interval' => '', 'backup_copies' => 1, 'backup_format_web' => 'default', 'backup_format_db' => 'gzip', 'active' => 'y', 'traffic_quota_lock' => 'n', 'http_port' => '80', 'https_port' => '443', 'log_retention' => '10' ); //* Add a web domain $web_domain_id = $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false); //* Print the results echo "Web Domain ID: ".$web_domain_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'parent_domain_id' => $web_domain_id, 'username' => $client_username.$ftp_host_username, 'username_prefix' => $client_username, 'password' => $ftp_host_password, 'quota_size' => 100, 'active' => 'y', 'uid' => 'web'.$web_domain_id, 'gid' => 'client'.$client_id, 'dir' => '/var/www/clients/client'.$client_id.'/web'.$web_domain_id, 'quota_files' => -1, 'ul_ratio' => -1, 'dl_ratio' => -1, 'ul_bandwidth' => -1, 'dl_bandwidth' => -1 ); //* Add a FTP user $ftp_id = $client->sites_ftp_user_add($session_id, $client_id, $params); //* Print the results echo "FTP User ID: ".$ftp_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'ip_address' => $server_ipv4, 'ipv6_address' => $server_ipv6, 'domain' => 'lg.'.$server_hostname_full, 'type' => 'vhost', 'parent_domain_id' => 0, 'vhost_type' => 'name', 'hd_quota' => 100, 'traffic_quota' => 10000, 'cgi' => 'y', 'ssi' => 'y', 'suexec' => 'y', 'errordocs' => 0, 'is_subdomainwww' => 1, 'subdomain' => 'www', 'php' => 'fast-cgi', 'server_php_id' => '1', 'ruby' => 'n', 'perl' => 'n', 'python' => 'n', 'redirect_type' => '', 'redirect_path' => '', 'ssl' => 'y', 'ssl_letsencrypt' => 'y', 'ssl_state' => '', 'ssl_locality' => '', 'ssl_organisation' => 'Default Org', 'ssl_organisation_unit' => 'IT', 'ssl_country' => 'US', 'ssl_domain' => 'lg.'.$server_hostname_full, 'ssl_request' => '', 'ssl_key' => '', 'ssl_cert' => '', 'ssl_bundle' => '', 'ssl_action' => 'create', 'stats_password' => '', 'stats_type' => 'webalizer', 'allow_override' => 'All', 'apache_directives' => '', 'php_open_basedir' => '/', 'php_fpm_use_socket' => 'y', 'pm' => 'ondemand', 'pm_max_children' => 10, 'pm_start_servers' => 2, 'pm_max_requests' => 0, 'pm_max_spare_servers' => 5, 'pm_process_idle_timeout' => 10, 'custom_php_ini' => '', 'backup_interval' => '', 'backup_copies' => 1, 'backup_format_web' => 'default', 'backup_format_db' => 'gzip', 'active' => 'y', 'traffic_quota_lock' => 'n', 'http_port' => '80', 'https_port' => '443', 'log_retention' => '10' ); //* Add a web domain $web_domain_id = $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false); //* Print the results echo "Web Domain ID: ".$web_domain_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'parent_domain_id' => $web_domain_id, 'username' => $client_username.$ftp_lg_username, 'username_prefix' => $client_username, 'password' => $ftp_lg_password, 'quota_size' => 100, 'active' => 'y', 'uid' => 'web'.$web_domain_id, 'gid' => 'client'.$client_id, 'dir' => '/var/www/clients/client'.$client_id.'/web'.$web_domain_id, 'quota_files' => -1, 'ul_ratio' => -1, 'dl_ratio' => -1, 'ul_bandwidth' => -1, 'dl_bandwidth' => -1 ); //* Add a FTP user $ftp_id = $client->sites_ftp_user_add($session_id, $client_id, $params); //* Print the results echo "FTP User ID: ".$ftp_id."\n"; //* Set the function parameters. $client_id = $client_ispc_id; $params = array( 'server_id' => 1, 'parent_domain_id' => $web_domain_id, 'username' => $client_username.$shell_lg_username, 'username_prefix' => $client_username, 'password' => $shell_lg_password, 'quota_size' => 100, 'active' => 'y', 'puser' => 'web'.$web_domain_id, 'pgroup' => 'client'.$client_id, 'shell' => '/bin/bash', 'dir' => '/var/www/clients/client'.$client_id.'/web'.$web_domain_id, 'chroot' => 'no' ); //* Add a shell user $shell_id = $client->sites_shell_user_add($session_id, $client_id, $params); //* Print the results echo "Shell User ID: ".$shell_id."\n"; //* Logout remote user if($client->logout($session_id)) { echo "Logged out\n"; } } catch (SoapFault $e) { echo "Last Response: ".$client->__getLastResponse()."\n"; die("SOAP Error: ".$e->getMessage()."\n"); } ?>