Ok . i will follow my other thread http://forum.mikrotik.com/viewtopic.php?f=9&t=37075
here because this board is more popular .
I am also using http://wiki.mikrotik.com/wiki/API_PHP_class
. it worked good but after some hours API returned cannot get challenge
and then script could not connect to API anymore .
Another strange thing is , i have seen a lot of sessions in "/user active print" . there are more than 44500
sessions there from user which i used for API connection but i have used $API->disconnect () .
You aren't following that example literally, are you? It does a login, one command, then logs out. You can log in once, do as many commands as you need to do, then disconnect (logout) once when you are finished for the session.
The script runs each time the specific page hits by a user so it should login , execute the command and then logout . the only way is a persistent connection with something like CURL or pfsockopen which needs customization of API_PHP_Class .
Maybe a "/quit" command sent just before the disconnect might drop the user from the active list.
Tried but unfortunately not worked
I have also test with mikrotik official python api client . it has same problem and does not clear the admin from "/user active print" .
even after sending /quit . with /quit it successfully closes the connection and raises "connection closed by remote end" but the admin is still remains alive at "/user active print" .
The problem is not just the growing number of active sessions . the main problem is cannot get challenge
after some hours and then unable to connect to API