簡単な php スクリプトを使用して Mikrotik Hostspot にユーザーを追加しています。
コードは次のとおりです。
<?php
$connection = ssh2_connect('192.168.3.201', 22);
ssh2_auth_password($connection, 'root', 'vonlinux');
$stream = ssh2_exec($connection, 'ssh admin@192.168.3.202 /ip hotspot user add disabled=no name='.$MOBILE.' password='.$VAR.' profile=default');
stream_set_blocking($stream, true);
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
echo stream_get_contents($stream_out);
?>
今私は何をしたいですか?実際に上記のコードを使用すると、Mikrotik ホットスポットで新しいユーザーを作成できます。ユーザーが既に終了している場合、このコードはそのユーザーのパスワードを更新する必要があります。
明確であることを願っています。
前もって感謝します...!