hi, i need remove active connections from PPPOE of a single user from with PHP API
paste a capture screen.
routeros_api.class.php use. my syntax is similar to the following but no found
by terminal I run this command: interface pppoe-server remove
<?php
include('routeros_api.class.php');
$Username="laklfasd";
$Pass="sadasjkdaskljd";
$api_puerto=8728;
$usuario = 'asdjlkasdl';
$ipRouteros = 'asdñaksdl';
//$comando = 'interface pppoe-server remove ';
\
\
\
\
$API = new routeros_api();
$API->debug = true;
if ($API->connect($ipRouteros , $Username , $Pass, $api_puerto)) {
$API->comm("interface pppoe-server remove ");
}
?>
THANKS!!!
try something like
$API->write(‘/interface/pppoe-server/print’, false);
$API->write(‘=.proplist=.id,name’);
$ARRAY = $API->read();
foreach($ARRAY as $keys=>$val){
if($ARRAY[$keys][‘name’] == ‘’){
$API->write(‘/interface/pppoe-server/remove’,false);
$API->write(‘=.id=’.$ARRAY[$keys][‘.id’]);
}
}
or
$API->write(‘/interface/pppoe-server/print’, false);
$API->write(‘=.proplist=.id’, false);
$API->write(‘?name=’);
$ARRAY = $API->read();
$API->write(‘/interface/pppoe-server/remove’,false);
$API->write(‘=.id=’.$ARRAY[0][‘.id’]);
I would print the output of $ARRAY via print_r($ARRAY) to make sure that is right on the id.
That is one way . you may need to fiddle with the exact pppoe fields but think that will work.
mwarren77:
try something like
$API->write(‘/interface/pppoe-server/print’, false);
$API->write(‘=.proplist=.id,name’);
$ARRAY = $API->read();
foreach($ARRAY as $keys=>$val){
if($ARRAY[$keys][‘name’] == ‘’){
$API->write(‘/interface/pppoe-server/remove’,false);
$API->write(‘=.id=’.$ARRAY[$keys][‘.id’]);
}
}
or
$API->write(‘/interface/pppoe-server/print’, false);
$API->write(‘=.proplist=.id’, false);
$API->write(‘?name=’);
$ARRAY = $API->read();
$API->write(‘/interface/pppoe-server/remove’,false);
$API->write(‘=.id=’.$ARRAY[0][‘.id’]);
I would print the output of $ARRAY via print_r($ARRAY) to make sure that is right on the id.
That is one way . you may need to fiddle with the exact pppoe fields but think that will work.
not found
returns
‘Connection attempt #1 to 10.28.1.2:8728… <<< [6] /login >>> [5/5] bytes read. >>> [5, 39]!done >>> [37/37] bytes read. >>> [37, 1]=ret=2cf454b8e830f77b78d7a9d5b33a73 <<< [6] /login <<< [14] =name=prueba <<< [44] =response=00473cbb0bc842e37c2aae464e44b07d >>> [5/5] bytes read. >>> [5, 1]!done Connected… <<< [42] /interface/pppoe-server/remove=.id=*F2CEFC’
but no delete to PPPO-SERVER
the user is 14703 do not know if you can delete via user.