View Single Post
  #7  
Old 16th August 2011, 12:09
osterhase osterhase is offline
Member
 
Join Date: Jul 2011
Location: Germany
Posts: 63
Thanks: 6
Thanked 7 Times in 5 Posts
Default

Allright it was a little fight, but I figured it out:

Code:
<?php

$username = 'xxx';
$password = 'xxx';

$soap_location = 'http://localhost:8005/remote/index.php';
$soap_uri = 'http://localhost:8005/remote/';


$client = new SoapClient(null, array('location' => $soap_location,
                                     'uri'      => $soap_uri));

try {
	if($session_id = $client->login($username,$password)) {
		echo 'Login sucessful. Session-ID:'.$session_id.'<br />';
	}

// START read out old paramter and hand back $params_old
	$primary_id = 113; // aka mailuser_id
	$domain__id = $client->mail_user_get($session_id, $primary_id);

	$params_old = $domain__id; 
// END read out old parameters


// New entries
	$params = $params_old;
	$params['custom_mailfilter'] = 'test24';
	$client_id = 7; // the ID of the customer who is owning the mail-account
	$mailuser_id = 113; // mailuser_id
	$domain__id = $client->mail_user_update($session_id, $client_id, $mailuser_id , $params);
//	echo $params['custom_mailfilter']; - testing purposes
// ENDE new entries

		if($client->logout($session_id)) {
		echo 'Logout succesful.<br />';
	}

	
} catch (SoapFault $e) {
	die('SOAP Blad: '.$e->getMessage());
}	

?>
But I have two remaining questions:

1. Is the variable "domain_id" changeable or is it in any way dangerous use it twice in the same script? (btw in the example files it is domain__id - is this correct or should domain_id be used?)

2. What's the thing with the client_id? The point being is that I only have the login-name (e-mailadress) of the user which is defined dynamically in the roundcube-sieve-plugin to gather the other informations needed (f.e. the mailuser_id). I'm not shure how to determine the client_id via a mysql-command. Therefore: Is the client_id necessary for the function because it does not seem to apear anywhere except in the client table?

I'm thankful for any suggestions and hints.

Best regards
Reply With Quote