好吧,我自己应对上使用Apache 2 + PHP 5.3 + MYSQL + ISPConfig 3。
自从版本3 ISPConfig附带一个简单的API,可以让您执行一些操作,如添加FTP用户,网站和数据库。
我离开这里的如何创建一个数据库的例子:
$params_db = array(
'server_id' => '1',
'system_user' => "web10",
'system_group' => 'client0',
'active' => 'y',
'type' => 'mysql',
'database_name' => $NAME,
'database_user' => $NAME,
'database_password' => '123456',
'database_charset' => 'utf8',
'remote_access' => 'n',
);
接下来我们要在ISPConfig面板上创建一个“远程用户”,允许使用网络服务来comunicate。
$soap_username = 'whatever';
$soap_password = 'h4ck3m3';
$soap_location = 'http://localhost:8080/remote/index.php';
$soap_uri = 'http://localhost:8080/remote/';
$client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri));
那么,接下来呢?
接下来我们调用Web服务器的功能是这样的:
try
{
//* Login to the remote server
if($session_id = $client->login($soap_username,$soap_password))
{
echo 'Logged into remote server sucessfully. The SessionID is '.$session_id. "\n";
$client->sites_database_add($session_id, $client_id, $params_db);
//* Logout
if($client->logout($session_id))
{
echo "DB Created\n";
}
}
}
catch (SoapFault $e)
{
die('SOAP Error: '.$e->getMessage());
}
欲了解更多信息,请查阅howtogeek网站的链接:http://www.howtoforge.com/how-to-create-remote-api-scripts-for-ispconfig-3