Hi, i try to make a small app to list all ssid and make it possible to swicht on or off.
Is here someone how know to help just with the list and edit state ( swicht on off ) script?
On the original api site i see nothing.
Big thx
Hi, i try to make a small app to list all ssid and make it possible to swicht on or off.
Is here someone how know to help just with the list and edit state ( swicht on off ) script?
On the original api site i see nothing.
Big thx
I can show you piece of code for listing firewall rules and disabling/enabling them, that should be enough to get you going.
$api = new routeros_api();
$api->debug = false;
$api->attempts = 2;
if($api->connect('192.168.88.1', 'username', 'password')) {
$api->write('/ip/firewall/filter/print', false);
$api->write('?chain=outgoing');
$tmp = $api->read(false);
$response = $api->parse_response($tmp);
foreach($response as $rule) {
echo 'id = '.$rule['.id'].'; comment = '.$rule['comment'].'; disabled = '.$rule['disabled'].PHP_EOL;
}
$api->disconnect();
} else {
echo 'error';
}
And when you want to change something:
$api->write('/ip/firewall/filter/set', false);
$api->write('=.id='.$id, false);
$api->write('=disabled='.$val);
$tmp = $api->read(false);
$response = $api->parse_response($tmp);
Thank you , i will try
do u know maybe the command for list the interfaces under the capsman? ssid and state.
thx
No, but it should use the same structure as config export.
so i figured out and now i need to make it editable
switch on off if i klick on the name…
maybe someone for this part? here is the code
| name | mac-address | Disabled? | ssid | hide ssid | |
| ";
for ($i=0; $i<10; $i++)
{
$regtable = $ARRAY[$i];
echo "" . $regtable['name'] . " "; } echo " | ";
for ($i=0; $i<10; $i++)
{
$regtable = $ARRAY[$i];
echo "" . $regtable['mac-address'] . " "; } echo " | ";
\
\
\
\
for ($i=0; $i<10; $i++)
{
$regtable = $ARRAY[$i];
echo "" . $regtable['disabled'] . " "; } echo " | ";
for ($i=0; $i<10; $i++)
{
$regtable = $ARRAY[$i];
echo "" . $regtable['configuration.ssid'] . " "; } echo " | ";
\
\
for ($i=0; $i<10; $i++)
{
$regtable = $ARRAY[$i];
if ($regtable['hide-ssid']=="true")
{
echo "" . $regtable['configuration.hide-ssid'] . " "; }else{ echo "". $regtable['configuration.hide-ssid'] ." "; } } echo " | "; \ \ \ \ \ echo " |
I am trying to set one CAP to enable —disable but no reaction
$id = “*B”;
$val = “false”;
$api->write(‘/ip/firewall/filter/set’, false);
$api->write(‘=.id=’.$id, false);
$api->write(‘=disabled=’.$val);