port tracking in php PEAR2 Api

hello ,

is there any way to get a result of this command
/ip firewall connection print where src-address ~“:80”

using Php PEAR2 Api i’ve been searching for a while and what i got that i can’t use “~” in my php query

so is there any ideas on query to get the same result using the api ?

thanks

API cannot do this, such selection must be done on your APP side.

… And to do it on the app side, you can use preg_match while iterating over all items. You may narrow them down with other allowed criteria if you want (e.g. search for only tcp connections that come from a known interface) to optimize the performance somewhat.

e.g. (without such criteria)

foreach ($util->setMenu('/ip firewall connection')->getAll() as $connection) {
    if (preg_match('/\:80$/', $connection->getProperty('src-address'))) {
        //Connection matches. Deal with it here
    }
}