(Remote) Get all existing domains saved on ISP regardless client or group id

Discussion in 'Installation/Configuration' started by bmi64, Sep 7, 2016.

  1. bmi64

    bmi64 New Member

    Hi there,

    I'm working on a script to create domains remotetly.
    The goal is to prevent creating a domain that is already existing on ISP.

    I'm trying to get all domains saved on ISP (3) regardless client or group id.
    I was first using a unique sys_group but it only returns the domains in this group.
    I'm now trying a new script but it takes lots of time, really a lot, because ISP already has lots domains, clients and groups.

    PHP:
    $ISPipServer 'X.X.X.X';
    $ISPsoap_id       'login';
    $ISPsoap_pass     'password';
    $ISPsoap_location 'https://'.$ISPipServer.':8080/remote/index.php';
    $ISPsoap_uri      'https://'.$ISPipServer.':8080/remote/';

    $ISPclient = new SoapClient(null, array('location' => $ISPsoap_location,
        
    'uri'      => $ISPsoap_uri,
        
    'trace' => 1,
        
    'exceptions' => 1));

    try {
      
    $startTime time();
      echo 
    'startTime : '.$startTime .'<br />';

      if(
    $ISPsession_id $ISPclient->login($ISPsoap_id$ISPsoap_pass)) {
        echo 
    'Logged successfull. Session ID:'.$ISPsession_id.'<br />';
      }
      echo 
    '$ groupInfos : Liste des domaines enregistrés :<br />';
      
    $existingDomains = array();
      for (
    $i=$i<1000$i++){

        
    $groupInfos $ISPclient->sites_web_domain_get($ISPsession_id, array('sys_groupid' => $i));// Tous les domaines et leurs infos

        
    if ($groupInfos) {
          
    // var_dump($groupInfos);
          
    foreach($groupInfos as $key => $value)
          {
            
    // var_dump($value);
            
    $existingDomains[] = $value['domain'];
          }
        }
      }

      
    $endTime time();
      echo 
    'endtime'.$endTime .'<br />';
      
    $interval $startTime $endTime;
      echo 
    'durée : '.$interval .'s<br />';

      
    var_dump($existingDomains);

    } catch (
    SoapFault $e) {
      echo 
    $client->__getLastResponse();
      die(
    'SOAP Error: '.$e->getMessage());
    }
    Is there a way to get a list of all recorded existing domains, or another way to prevent creating a domain already saved ?

    Thanks for help !
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    $sites = $ISPclient->sites_web_domain_get($ISPsession_id, array('active' => 'y'));

    $site_mydomain = $ISPclient->sites_web_domain_get($ISPsession_id, array('domain' => $mydomain));
    if(!is_array($site_mydomain)) {
    echo 'mydomain does not exist';
    }
     
  3. bmi64

    bmi64 New Member

    Thanks a lot for your help !
    I was already using the second one with false value if domain already exists.
    I'm actually using 'remoting_client' folder found in ISPConfig-3.0.5.4p9 source that list all functions but there is not a lots of informations about remote scripts.
    Is there a webpage listing informations and remote scripts and functions ?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    all available information is in the remote_client folder of the ispconfig tar.gz file.
     
  5. bmi64

    bmi64 New Member

    ok, I'll continue using it, but for example this one couldn't be found :
    PHP:
    $sites $ISPclient->sites_web_domain_get($ISPsession_id, array('active' => 'y'));
    it only says :
    PHP:
    sites_web_domain_get($session_id$primary_id);
    Input Variables:
    $session_id, $primary_id
    Parameters (in $params):
    None
    Output:
    Returns all fields and values of the chosen web domain.

    thank you !
     

Share This Page