firewall connection print problem [php]

I can’t print connection table in ip/firewall/connection. I use this code

							$util->setMenu('/ip firewall connection');	
							$get = $util->getAll();
							print_r($get);

ERROR =

Fatal error: Uncaught exception ‘PEAR2\Net\RouterOS\InvalidArgumentException’ with message ‘Invalid name of argument supplied.’ in C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\Message.php:96 Stack trace: #0 C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\Message.php(221): PEAR2\Net\RouterOS\Message::sanitizeAttributeName(‘seen reply’) #1 C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\Response.php(219): PEAR2\Net\RouterOS\Message->setAttribute(‘seen reply’, ‘false’) #2 C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\Response.php(111): PEAR2\Net\RouterOS\Response->_receive(Object(PEAR2\Net\RouterOS\Communicator), false, NULL, 0) #3 C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\Client.php(793): PEAR2\Net\RouterOS\Response->__construct(Object(PEAR2\Net\RouterOS\Communicator), false, NULL, 0, NULL) #4 C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\Client.php(458): PEAR2\Net\RouterOS\Client->dispatchNextResponse(NULL) #5 C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\Client.php(432): PEAR2\Net\RouterOS\Client->completeRequest(NULL) #6 C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\ in C:\xampp\htdocs\pjv2\PEAR2\Net\RouterOS\Message.php on line 96

This code

					$responses = $client->sendSync(new RouterOS\Request('/ip/firewall/connection/print'));
					print_r($responses);

SAME ERROR.

Are there other way to get firewall connection information?

Thank you.

In earlier RouterOS versions, this menu contains a property called “seen reply”. Because this property contains a space, it trips up the API client (as it would trip up scripting BTW), as property names shouldn’t be containing spaces (as this is an argument/property separator).

There’s two solutions to this:

  1. (recommended) Upgrade RouterOS. I’m not sure exactly in which version they fixed this (I think it was 6.22; I reported this issue during 6.21.1’s life, and considering the triviality of the fix…). It’s certainly already fixed in 6.27. Said property is renamed to “seen-reply”,
  2. Add “.proplist” that has all things you need… except that. This will make sure RouterOS doesn’t return this property. e.g.
                     $util->setMenu('/ip firewall connection');   
                     $get = $util->getAll(array('.proplist' => 'assured,gre-key,icmp-id,reply-dst-address,tcp-state,connection-mark,gre-protocol,icmp-type,reply-src-address,timeout,connection-type,gre-version,p2p,,dst-address,icmp-code,protocol,src-address'));
                     print_r($get);

or

               $responses = $client->sendSync(new RouterOS\Request('/ip/firewall/connection/print .proplist=assured,gre-key,icmp-id,reply-dst-address,tcp-state,connection-mark,gre-protocol,icmp-type,reply-src-address,timeout,connection-type,gre-version,p2p,dst-address,icmp-code,protocol,src-address'));
               print_r($responses);