Change Hostname

Description

Use the Change Hostname API's to Update Webuzo Configuration , Webuzo Panel Settings and Webuzo Panel Ports.

Update Webuzo Configuration

Use this API for Update Webuzo Configuration.

API response The configuration was saved successfully.

Parameters

Sample Code

curl --insecure -d "editconfigs=1" -d "WU_PRIMARY_IP=ipv4" -d "WU_PRIMARY_IPV6=ipv6" -d "WU_PRIMARY_DOMAIN=domain.com" -d "WU_NS1=ns1.com" -d "WU_NS2=ns2.com"  -d "quota=true" -X POST  "https://hostname:2005/index.php?api=json&act=webuzoconfigs&apiuser=user_name&apikey=pass_api_key"
<?php
 
 $url = 'https://hostname:2005/index.php?api=json&act=webuzoconfigs&apiuser=user_name&apikey=pass_api_key'; 

 $post = array('editconfigs' => 1,
	       'WU_PRIMARY_IP' => 'ipv4',
	       'WU_PRIMARY_IPV6' => 'ipv6',
	       'WU_PRIMARY_DOMAIN' => 'domain.com',
	       'WU_NS1' => 'ns1.com',
	       'WU_NS2' => 'ns2.com',
	       'quota' => true	
 );


// Set the curl parameters 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

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. 
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
    echo "<pre>";
    print_r($res['done']['msg']);
    echo "</pre>";
}else{
	print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');

$user = 'user_name';
$pass = 'password';
$host = 'hostname';

$webuzo = new Webuzo_Admin_SDK($user, $pass, $host);

$ip = 'ip';
$domain = 'domain.com';
$ipv6 = 'ipv6',
$ns1 = 'ns1.example.com';
$ns2 = 'ns2.example.com';
$quota = true;

$res = $webuzo->set_panel_config($ip, $domain, $ipv6, $ns1, $ns2, $quota);

// Done/Error
if(!empty($res['error'])){
	print_r($res['error']);
}else{
	print_r($res['done']['msg']);
}

?>

Output

The configuration was saved successfully

Webuzo Panel Settings

Use this API for Update Webuzo Panel Setting.

API response The Webuzo PHP settings were saved successfully

Parameters

Sample Code

curl --insecure -d "max_execution_time=minimum_30" -d "post_max_size=minimum_128"   -X POST  "https://hostname:2005/index.php?api=json&act=webuzoconfigs&webuzophpsettings=1&apiuser=user_name&apikey=pass_api_key"
<?php
 
 $url = 'https://hostname:2005/index.php?api=json&act=webuzoconfigs&apiuser=user_name&apikey=pass_api_key'; 

 $post = array('webuzophpsettings' => 1,
		'max_execution_time' => 30,
		'post_max_size' => 128,
		'upload_max_filesize' => 128,
		'client_max_body_size' => 128,
		'pm_max_children' => 10,
		'pm_start_servers' => 3,
		'pm_min_spare_servers' => 2,
		'pm_max_spare_servers' => 4,
		'pm_max_requests'=> 500,
		'request_terminate_timeout' => 120
 );


// Set the curl parameters 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

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. 
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
    echo "<pre>";
    print_r($res['done']['msg']);
    echo "</pre>";
}else{
	print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');

$user = 'user_name';
$pass = 'password';
$host = 'hostname';

$webuzo = new Webuzo_Admin_SDK($user, $pass, $host);

$max_execution_time = 180;
$post_max_size = 128;
$upload_max_filesize = 128;
$client_max_body_size = 128;
$pm_max_children = 10;
$pm_start_servers = 3;
$pm_min_spare_servers = 2;
$pm_max_spare_servers = 4;
$pm_max_requests= 500;
$request_terminate_timeout = 120;

$res = $webuzo->set_panel_setting($max_execution_time, $post_max_size, $upload_max_filesize, $client_max_body_size, $pm_max_children, $pm_start_servers, $pm_min_spare_servers, $pm_max_spare_servers, $pm_max_requests, $request_terminate_timeout);

// Done/Error
if(!empty($res['error'])){
	print_r($res['error']);
}else{
	print_r($res['done']['msg']);
}

?>

Output

The Webuzo PHP settings were saved successfully

Webuzo Panel Ports

Use this API for Set custom Webuzo Panel ports.

API response The Webuzo Panel Ports were saved successfully

Parameters

Sample Code

curl --insecure -d "admin_port_ssl=port_no" -d "admin_port_nonssl=port_no" -d "enduser_port_ssl=port_no" -d "enduser_port_nonssl=port_no" -X POST  "https://hostname:2005/index.php?api=json&act=webuzoconfigs&webuzo_ports=1&apiuser=user_name&apikey=pass_api_key"
<?php
 
 $url = 'https://hostname:2005/index.php?api=json&act=webuzoconfigs&apiuser=user_name&apikey=pass_api_key'; 

 $post = array('webuzo_ports' => 1,
		'admin_port_ssl' => 'port_no',
		'admin_port_nonssl' => 'port_no',
		'enduser_port_ssl' => 'port_no',
		'enduser_port_nonssl' => 'port_no'
 );


// Set the curl parameters 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

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. 
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
    echo "<pre>";
    print_r($res['done']['msg']);
    echo "</pre>";
}else{
	print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');

$user = 'user_name';
$pass = 'password';
$host = 'hostname';

$webuzo = new Webuzo_Admin_SDK($user, $pass, $host);

$admin_port_ssl = 'port_no';
$admin_port_nonssl = 'port_no';
$enduser_port_ssl = 'port_no';
$enduser_port_nonssl = 'port_no';

$res = $webuzo->set_panel_ports($admin_port_ssl, $admin_port_nonssl, $enduser_port_ssl, $enduser_port_nonssl);

// Done/Error
if(!empty($res['error'])){
	print_r($res['error']);
}else{
	print_r($res['done']['msg']);
}

?>

Output

The Webuzo Panel Ports were saved successfully

Was this page helpful?