PDA

View Full Version : Automatic user creation script with PHP and SOAP


Jose Gosalbez
24th May 2006, 17:00
I have installed the SOAP addon in ISPCONFIG and after I put the PHP examples in a server directory.

I have created a remote user with the login "remote" and the pass "remote"

Mi title for the domain is "Main"

This is the code I Tried

/******************************************* */

include("soap.lib.php");

// Insert here your 42go Server
$server_url = "https://localhost:81";

// creating object for SoapClient
$soapclient = new soapclient($server_url.'/remote/index.php');

// Username and Password of the remoting user (not identical
// with the user to log into the web interface!)

$parameters = array('user' => 'remote',
'pass' => 'remote');

// Login into 42go Server
$session_id = $soapclient->call('login',$parameters);

// Error Check
if($err = $soapclient->getError()) die("Error: ".$err);


// Add a User
$params = array ( 'sid' => $session_id,
'module' => 'web',
'function' => 'user_add',
'params' => array ( web_title => 'main', // web_title or web_id
user_username => 'prueba',
user_name => 'prueba',
user_email => 'prueba',
user_passwort => '123456',
user_speicher => 10,
user_mailquota => 10,
user_admin => 0
));

$user_id = $soapclient->call('service',$params);
if($err = $soapclient->getError()) die("Error: ".$err);
print_r($user_id);


/************************************************** ****/

This script doesnt say anything... but the user is not added to "Main" account. Why?

I have ISPCONFIG 2.2.2.... Need I a upgrade?

falko
24th May 2006, 19:08
$server_url = "https://localhost:81";

// creating object for SoapClient
$soapclient = new soapclient($server_url.'/remote/index.php');

// Username and Password of the remoting user (not identical
// with the user to log into the web interface!)

$parameters = array('user' => 'remote',
'pass' => 'remote');


Is the URL correct? Are the username and password correct?

till
24th May 2006, 19:11
I have ISPCONFIG 2.2.2.... Need I a upgrade?


Remoting is not supported by ISPConfig 2.2.2. Only the development releases support remoting yet!

Before you update to 2.3.1-dev, dont forget to install the libxml2-dev package from your linux distribution, or the upgrade will fail.