I am using a simple php script to add user in Mikrotik Hostspot.
Here is the code :
<?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);
?>
Now what i want ? Actually with the above code i am able to create a new user in Mikrotik hotspot Now, if the user is already exit this code should update the password of that user.
Hope its clear, Any help would be Appreciated.
Thanks in Advance...!