I’m new to the API
and I have done a few tries using the examples provided,
http://wiki.mikrotik.com/wiki/API_PHP_class
to change the ssid from my wireless interface that normaly i would use on the terminal
interface wireless set ssid=“myMikro” numbers=0
, after this i wan’t to enable or disable the wireless interface, but without luck also.
<?php
require('routeros_api.class.php');
$API = new routeros_api();
$API->debug = true;
if ($API->connect('192.168.1.210', 'admin', '')) {
//test 998
$ARRAY = $API->write('/interface/wireless/set/',array('numbers'=>0,'ssid'=>'skjdlksj'));
print_r($ARRAY);
//test 999
$ARRAY = $API->comm('/interface/wireless/set',array("numbers"=>0,"ssid"=>"sksksk2"));
print_r($ARRAY);
}
can anyone point what i’m doing wrong
Many thanks
The API protocol does not support numbers. You typically need to use the item’s ID.
In the case of interfaces, I believe you should also be able to use the interface name. I’m certain you can do that from the “/interface” menu at least.
heei,
i know this is an old post,
but im strugling with this and cant figure it out how,
i cant get it working i got know
<?php
require('routeros_api.class.php');
$API = new routeros_api();
$API->debug = true;
if ($API->connect('XX.X.X.XXX', 'USERNAME', 'PASSWORD')) {
$ARRAY = $API->write('/interface/wireless/set/',array('numbers'=>0 , 'ssid'=>'test123'));
print_r($ARRAY);
$API->disconnect();
}
?>
can you tell me what u did?
Hello,
I also know this is an old post, but has anyone managed to get this working?
Im using something like this (not PHP but the principle is the same):
var commands = new List() {
“/interface/wireless/set”,
“=.id=wlan1”,
“=address=” + ap.Address,
“=ssid=” + ap.SSID,
“=channel=” + ap.Channel,
“=radio-name=” + ap.RadioName
};
if (ap.SNR.HasValue)
{
commands.Add(“=snr=” + ap.SNR.ToString());
}
if (ap.Signal.HasValue)
{
commands.Add(“=sig=” + ap.Signal.ToString());
}
if (ap.NF.HasValue)
{
commands.Add(“=nf=” + ap.NF.ToString());
}
if (!string.IsNullOrWhiteSpace(ap.Section))
{
commands.Add(“=.section=” + ap.Section);
}
await Write(commands);
But this doesn’t do anything. I’ve tried sending only ssid and .id but nothing.
Marco, could you please show us your last source code to set the SSID?.