Page 1 of 1

How could I send this commands from my php script via api?

Posted: Tue Jun 16, 2020 9:06 pm
by bobrovski
Hi! I need to send these 2 commands from php script via api:
/ip dhcp-server lease make-static [/ip dhcp-server lease find address="1.1.1.1"]
/ip dhcp-server lease comment [/ip dhcp-server lease find address="1.1.1.1"] my_comment
How could I do it? I need to make certain dhcp lease static(I know only ip) and then add comment to it.
I tried this code, but it doesn't work:
<?php
require('mikrotik_api.php');
$API = new RouterosAPI();
$API->debug = false;
if ($API->connect('ip', 'login', 'pass')) {
$ARRAY = $API->comm('/ip/dhcp-server/lease/make-static/[/ip dhcp-server lease find address="1.1.1.1"]');}