fixx
March 15, 2013, 8:23pm
1
Hi Guys
I am using the following PHP class:
http://wiki.mikrotik.com/wiki/API_PHP_class
I want to send a username to the script to disable the ppp secret as well as the current l2tp connection. Something along the lines of (Yes I know its completely wrong, which is why I am here)
.....[snip]
$username = $_POST[username];
$API->comm("/ppp/secret/disable [/ppp/secret/find]", array(
"name" => "$username"
));
I am sure you get the idea of what I am trying to achieve right?
I want to pass a username to the script (using ajax) and let the script look for the correct ID and disable that user.
Thanks in advance for the help!
fixx
March 15, 2013, 8:34pm
2
I have also tried the following:
$API->comm("/ppp/secret/disable", array(
"numbers" => 1
));
The response is:
Connection attempt #1 to 10.10.30.98:8728âŚ<<< [6] /login>>> [5/5] bytes read.>>> [5, 39]!done>>> [37/37] bytes read.>>> [37, 1]=ret=115ee638ce500bc1ac2b6b1204cb1d8b<<< [6] /login<<< [11] =name=admin<<< [44] =response=00d2a09f0588dc19ed2f2302f5de53bb99>>> [5/5] bytes read.>>> [5, 1]!doneConnectedâŚ<<< [19] /ppp/secret/disable<<< [10] =numbers=1>>> [5/5] bytes read.>>> [5, 42]!trap>>> [11/11] bytes read.>>> [11, 30]=category=0>>> [21/21] bytes read.>>> [21, 8]=> message=no such item> >>> [5/5] bytes read.>>> [5, 1]!doneDisconnectedâŚ
Have you tried
$API->comm("/ppp/secret/disable", array(
"numbers" => $username
));
?
If even that doesnât work, youâll need to make a separate print request with an appropriate API query, and get the ID out of that. Once you have the ID, insert it as a value to ânumbersâ.
fixx
March 18, 2013, 5:43am
4
Ahh, that works perfect. Thank you.