too long

I am trying to add and remove NAT entry using a single line php api code but unable to do it.

Terminal code Mikrotik:

/ip firewall nat remove [find comment=id9]

//Its working fine on terminal

I am trying writing bellow php api:

to Add:

$API->comm("/ip/firewall/nat/add =chain=dstnat =src-address=103.19.131.3 =protocol=tcp =action=dst-nat =comment=id9 =to-addresses=103.19.130.215 =to-ports=80");

//Working fine

to remove:

$API->comm("/ip/firewall/nat/remove/[find =comment=id9]");

 //Not working

Can anyone help me to solve it? Thanks in advance.

Its done. Bellow is the code:

//Remove Mikrotik NAT using PHP API

$API->write('/ip/firewall/nat/print', false);
$API->write('?comment=id9', false);
$API->write('=.proplist=.id');
$ARRAYS = $API->read();

$API->write('/ip/firewall/nat/remove', false);
$API->write('=.id=' . $ARRAYS[0]['.id']);
$READ = $API->read();

Thanks all for trying.

It seems a typo;

$API->comm("/ip/firewall/nat/remove =[find =comment=id9]");

I think you must correct the command

$API->comm("/ip/firewall/nat/remove/[/ip/firewall/nat/find
=comment=id9]");