2

directAdmin Web コントロール APIを使用して共有 Web ホスティングに新しいデータベースを作成しようとしています。以下のコードを使用して directAdmin に接続し、データベースを作成しますが、php スクリプトを開くと、直接管理者にログインせず、ログイン ページが表示されません。

include 'httpsocket.php';

$sock = new HTTPSocket;
$sock->connect('xx.xx.xx.xx',2222);

$user = getenv('xxxxxxx');
$pass = getenv('xxxxxxx');

$sock->set_login("${user}","${pass}");

$sock->set_method('POST');

$sock->query('/CMD_API_DATABASES',
       array(
            'action' => 'create',
            'name' => "Test101",
            'user' => "dbuser",
            'passwd' => "$pass",
            'passwd2' => "$pass",
));

$result = $sock->fetch_body();

echo $result;
4

0 に答える 0