routeros-api-php
routeros-api-php copied to clipboard
new version not working
Hi,
hotspot user add
// Initiate client with config object
$client = new Client([
'timeout' => 1,
'host' => $ip,
'user' => $user_name,
'pass' => $password
]);
$hotspot_user_control = $client->query('/ip/hotspot/user/print', ['name', "$hotspot_user"])->read();
if (isset($hotspot_user_control[0]['.id'])) {
$userId = $hotspot_user_control[0]['.id'];
echo 'Update';
$out = $client->write(["/ip/hotspot/user/set","=password=$hotspot_user_pass","=.id=$userId"])->read();
}
else
{
echo 'New';
$out = $client->write(['/ip/hotspot/user/add', "=name=$hotspot_user","=password=$hotspot_user_pass",])->read();
}
Remove Hotspot User:
$client = new Client([
'timeout' => 1,
'host' => $ip,
'user' => $user_name,
'pass' => $password
]);
$user = $client->query('/ip/hotspot/user/print', ['name', $hotspot_user])->read();
if (isset($user[0]['.id'])) {
$userId = $user[0]['.id'];
echo $userId;
echo '<hr>';
$out = $client->write(["/ip/hotspot/user/remove","=.id=$userId"])->read();
}
new version update don't work
Hello! New version of what? RouterOS? This API client library?