find all domains for a specific client

Discussion in 'ISPConfig 3 Priority Support' started by saco721, Jun 20, 2017.

  1. saco721

    saco721 Member

    Hi,
    I have installed ISPConfig 3.1.2 on debian jessie multiserver setup. I was wondering how I could go about finding what domains belong to a specific client, for example, domain1.com, domain2.com for client user, domain3.com, domain4.com for client user2 etc. I have looked at domains_get_all_by_user.php, but it always returns :
    Any help is greatly appreciated, thanks.
     
    Last edited: Jun 20, 2017
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I would use the function, e.g.:

    $remoteclient->sites_web_domain_get($session_id, array('sys_groupid' => 1));

    where 1 is the group id of the client group. And if you don't have the groupid of a client, then you can get it like this:

    $remoteclient->client_get_groupid($session_id, $client_id);

    sys_group
     
  3. saco721

    saco721 Member

    Hi Till,
    Thanks for your time. sites_web_domain_get works as it should but i'm getting the domain with a prefix, ie, site1.domain1.com instead of just domain1.com. I presume this is because subdomain site1.domain1.com is setup as a website instead of subdomain for website. But how do get just the domain?. I tried using :

    where 1 is the group id of name: admin, client_id: 0.
    but it doesn't return anything, apart from :
    I have attached the script.
     

    Attached Files:

    Last edited: Jun 20, 2017
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    When you setup a website and enter 'site1.domain1.com' into the domain field of this website, then the domain name of this website is 'site1.domain1.com' and not 'domain1.com'. The api returns what you entered in ISPConfig.

    If you want to query the database for other alias domains that you might have added to a site, then use the alias and subdomain query functions.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    And if you entered domains with a site1 prefix in ISPConfig instead of the domain, then you can e.g. split the domain name you got from the api by dots and remove the first part.
     
  6. saco721

    saco721 Member

    Thanks very much Till.
     
  7. saco721

    saco721 Member

    Hi Till, am still having difficulties getting all domains for a specific client, here is the script :

    Code:
    <?php
    
    require 'soap_config.php';
    
    
    $client = new SoapClient(null, array('location' => $soap_location,
            'uri'      => $soap_uri,
            'trace' => 1,
            'exceptions' => 1));
    
    
    try {
        if($session_id = $client->login($username, $password)) {
            echo 'Logged successfull. Session ID:'.$session_id.'<br />';
    
        }
    
       
        $remoteClient->sites_web_domain_get($session_id, array('sys_groupid' => 1));
    
    
       
    
    
        print_r($remoteClient);
        if($client->logout($session_id)) {
            echo 'Logged out .<br />';
        }
    
    
    } catch (SoapFault $e) {
        echo $client->__getLastResponse();
        die('SOAP Error: '.$e->getMessage());
    }
    
    ?>
    

    'sys_groupid' => 1 does exist, and has 2 subdomains (www.mydomain.com & www.mydomain.org, but nothing is returned. Where am I going wrong? Thanks for your help!.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    and this domain is a website and not a vhost aliasdomain?
     
  9. saco721

    saco721 Member

    Hi Till,
    the domains are websites and not vhost alias domains.
     
  10. saco721

    saco721 Member

    Hi Till,
    problem solved, sorry for wasting time:)
     

Share This Page