API Crash

I’m trying to make a script that read my database certain customers to cut, but try to add the ip of those customers to an “address list” and the script remains in a loop, and tried in two ways and I think the API is a bug, someone could help me

##########################api crash 1 ####################################

$API-> comm(‘/ip/firewall/address-list/add’, array (
“list” => “Drop”,
“address” => “1.1.1.3”,
“comment” => “3”
));
$API-> comm(‘/ip/firewall/address-list/add’, array (
“list” => “Drop”,
“address” => “1.1.1.2”,
“comment” => “2”
));

#############################api crash 2####################


$API2->write(“/ip/firewall/address-list/add”, false);
$API2->write(“=address=”.$ip,false);
$API2->write(“=list=cortados”, false);
$API2->write(“=comment=$contrato”, true);
$READ = $API2->read(false);
$ARRAY2 = $API2->parse_response($READ);