Run script with php api

I have one problem,the script in mikrotik is script that remove address from address list and working great when runing from winbox.But when i run php code:
require(‘api.php’);

$API = new routeros_api();

$API->debug = true;

if ($API->connect(‘111.111.111.1’, ‘adop’, ‘user’)) {

$API->write(‘/system/script/run’,false);
$API->write(“=.id=*16”);


$API->disconnect();

}
count on winbox for this script is say that script is runed and every time i runed this php code count is rising but nothing happend.What is problem,authorisating or somthing???Sorry for bad english

Does the script by any chance use numbers?

I think maybe RouterOS is trying to execute the script as if it was executing API commands… but that means you can’t use numbers in your script.

Script is:
/ip firewall address-list {
remove [find address=192.168.111.245]
}
and router say when i run php that script is executed but nothing happend;

Try to do a single read() before you disconnect.

Also, try to linearize the script, e.g.

/ip firewall address-list
remove [find address=192.168.111.245]

Thank you for your answers ,but this is what i get from api in browser:
Connection attempt #1 to 192.168.111.1:8728… <<< [6] /login >>> [5/5] bytes read. >>> [5, 39]!done >>> [37/37] bytes read. >>> [37, 1]=ret=f5990f4609726bb20a147d7031242c5e <<< [6] /login <<< [11] =name=admin <<< [44] =response=006f848e08707c84cdc832a2777bfc626b >>> [5/5] bytes read. >>> [5, 1]!done Connected… <<< [18] /system/script/run <<< [8] =.id=*17 Disconnected…

and again counter says one number more but nothing happend;

Do a read() I tell ya.

If you do one more read(), the end of that output should be more like

<<< [18] /system/script/run <<< [8] =.id=*17 >>> [5/5] bytes read. >>> [5, 5]!done Disconnected...

ok i will do that but i dont understand what mean with this single read(),example??Please;

$API->write("=.id=*16");

$API->read();

i do exactly same but again response from api is:

Connection attempt #1 to 192.168.111.1:8728… <<< [6] /login >>> [5/5] bytes read. >>> [5, 39]!done >>> [37/37] bytes read. >>> [37, 1]=ret=1300078c7e914e04a7ac177c14b02981 <<< [6] /login <<< [11] =name=admin <<< [44] =response=007c600f1cfd137f7a9074aa96524f67f8 >>> [5/5] bytes read. >>> [5, 1]!done Connected… <<< [18] /system/script/run <<< [8] =.id=*17 Disconnected…