Community discussions

MikroTik App
 
tvoyson
just joined
Topic Author
Posts: 1
Joined: Fri Jun 17, 2022 5:05 pm

Help me write a script using the API

Fri Jun 17, 2022 5:26 pm

There is such a script
:local exists false; :foreach i in=[/queue simple find name=user1 limit=1k/1k] do={:log info ("Blocked" ); :set exists true}; :if (!$exists) do={ :log info ("Active" ) }
Please help me write a similar script using the API

php code

<?php

function f_add_user($login, $speed)

{
require('routeros_api.class.php');

$API = new RouterosAPI();
if ($API->connect('10.0.0.11', 'user', '12345')) { 

$API->write('/queue/simple/print', false);
 $API->write('?name='. $login, '?limit='. $limit, false);
 $API->write('=.proplist=.id');
 $ARRAYS = $API->read();
 

Who is online

Users browsing this forum: ko00000000001 and 16 guests