Hey guys,
I’m trying to use PHP to disable and enable a route with this code:
$API = new routeros_api();
if ($API->connect($RBIP, 'admin', 'password'))
{
$ARRAY = $API->comm('/ip/route/print
?=dst-address=0.0.0.0/0');
if ($ARRAY[0][disabled] == 'false')
{
$API->write('/ip/route/set', false);
$API->write('.id='.$ARRAY[0]['.id'], false);
$API->write('=disabled=true');
$API->write('!done');
popMsg("Disabled Internet");
}
else
{
$API->write('/ip/route/set', false);
$API->write('.id='.$ARRAY[0]['.id'], false);
$API->write('=disabled=false');
$API->write('!done');
popMsg("Enabled Internet");
}
$API->disconnect();
}
else
{
echo 'Unable to connect to RB';
}
Could you please point me in the right direction as to why it isn’t working?
Thanks