Example #1
0
<?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 />';
    }
    //* Set the function parameters.
    $domain_id = 1;
    $mail_domain_record = $client->mail_domain_get($session_id, $domain_id);
    print_r($mail_domain_record);
    if ($client->logout($session_id)) {
        echo 'Logged out.<br />';
    }
} catch (SoapFault $e) {
    echo $client->__getLastResponse();
    die('SOAP Error: ' . $e->getMessage());
}
 $clients = $app->db->queryAllRecords($sql);
 $client_select = "";
 if (is_array($clients)) {
     foreach ($clients as $client) {
         $selected = @($client['groupid'] == $_POST['client_group_id']) ? 'SELECTED' : '';
         $client_select .= "<option value='{$client['groupid']}' {$selected}>{$client['name']}</option>\r\n";
     }
 }
 $app->tpl->setVar("client_group_id", $client_select);
 try {
     $client = new SoapClient(null, array('location' => $_POST['remote_server'], 'uri' => $_POST['remote_server'] . '/index.php', 'trace' => 1, 'exceptions' => 1));
     if (!isset($remote_session_id)) {
         $remote_session_id = $_POST['remote_session_id'];
     }
     //* Get all email domains
     $mail_domains = $client->mail_domain_get($remote_session_id, array('active' => 'y'));
     $mail_domain_select = '<option value="">-- select domain --</option>';
     if (is_array($mail_domains)) {
         foreach ($mail_domains as $mail_domain) {
             $selected = @($mail_domain['domain'] == $_POST['mail_domain']) ? 'SELECTED' : '';
             $mail_domain_select .= "<option value='{$mail_domain['domain']}' {$selected}>{$mail_domain['domain']}</option>\r\n";
         }
     }
     $app->tpl->setVar("mail_domain", $mail_domain_select);
     //* Do the import
     if ($_POST['mail_domain'] != '') {
         start_domain_import($_POST['mail_domain']);
     }
 } catch (SoapFault $e) {
     //echo $client->__getLastResponse();
     $error .= $e->getMessage();