Domain List

Description

Use the Domains List API to list domains on your server.

The API response will be list of domains.

Parameters

Sample Code

curl --insecure -u "user_name:password" "https://hostname:2005/index.php?api=json&act=domains"
<?php
$user = 'username';
$pass = 'password';
$host = 'hostname';
 
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$host.':2005/index.php?api=json&act=domains'; 

// To get all domains hosted on the server for all users
$post = ['user_search'=> '', 'dom_search'=> '', 'reslen'=> 'all', 'page'=> 0];

// 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);
if(!empty(curl_error($ch))){
	echo curl_error($ch); die();
}

// The response will hold a string as per the API response method. 
$res = json_decode($resp, true);

echo "<pre>";
print_r($res['domains']);
echo "</pre>";
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');
$user = 'username';
$pass = 'password';
$host = 'hostname';

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

$res = $webuzo->list_domains($user_search = '', $domain = '',  $reslen = 'all', $page = 0);

echo "<pre>";
print_r($res['domains']);
echo "</pre>";

Sample Output

Array
(
    [61] => Array
        (
            [domid] => 61
            [user] => dummyuser1
            [owner] => root
            [domain] => domain1.com
            [path] => /home/dummyuser1/public_html
            [type] => primary
            [php_version] => 
            [cert] => 0
            [ip] => server_ip
            [ipv6] => 
        )

    [65] => Array
        (
            [domid] => 65
            [user] => dummyuser1
            [owner] => root
            [domain] => domain2.com
            [path] => /home/dummyuser1/domain2.com
            [type] => parked
            [php_version] => 
            [cert] => 0
            [ip] => server_ip
            [ipv6] => 
        )

    [77] => Array
        (
            [domid] => 77
            [user] => dummyuser2
            [owner] => root
            [domain] => domain3.com
            [path] => /home/dummyuser2/public_html
            [type] => primary
            [php_version] => 
            [cert] => 0
            [ip] => server_ip
            [ipv6] => 
        )

    [79] => Array
        (
            [domid] => 79
            [user] => dummyuser2
            [owner] => root
            [domain] => sub.domain3.com
            [path] => /home/dummyuser2/sub
            [type] => subdomain
            [php_version] => 
            [cert] => 0
            [ip] => server_ip
            [ipv6] => 
        )
)
Was this page helpful?