Community discussions

 
LordNiko
just joined
Topic Author
Posts: 1
Joined: Thu Aug 22, 2019 12:43 am

Send remove client from active connections command from php API

Thu Aug 22, 2019 2:02 am

So, i have this little code which update the profile to a especific secret:

Code: Select all

<?php
if($plan == 0){
$plan_rOS = "PLAN2M";
}else if($plan == 1){
$plan_rOS = "PLAN4M";
}else if($plan == 2){
$plan_rOS = "PLAN6M";
}else if($plan == 3){
$plan_rOS = "PLAN8M";
}else if($plan == 4){
$plan_rOS = "PLAN10M";
}else if($plan == 5){
$plan_rOS = "PLAN30M";
}else if($plan == 6){
$plan_rOS = "PLAN100M";
}else if($plan == 7){
$plan_rOS = "Desconectado";
}

require_once __DIR__ . '/vendor/autoload.php';

error_reporting(E_ALL);

use \RouterOS\Client;
use \RouterOS\Query;

// Initiate client with config object
$client = new Client([
'host' => '"',
'user' => '"',
'pass' => '"',
'port' => 8087,
]);


// Build query
$query = new Query('/ppp/secret/set');
$query->add('=numbers='.$cedula.'');
$query->add('=profile='.$plan_rOS.'');

$query = new Query('/ppp/active/remove');
$query->add('=find='.$cedula.'');


// Send query to RouterOS
$response = $client->write($query)->read();
print_r($response);


?>
But i have to manually remove it from active connections in order to update the profile.
So, i investigated and found this command to remove the clients from the winbox console:
ppp active remove [find name=<SECRET>]
BUT, when i came to the actual API, the way to made the command, is way different, and in the documentation for the API this doesn't appear (or im way so nobby to understand) https://github.com/EvilFreelancer/routeros-api-php

So, i come here and ask you guys if someone know how construct this type of command in the API.
Thanks.

Who is online

Users browsing this forum: No registered users and 7 guests