scriptingmikrotik

Mikrotik post data from a print


If i try to get some data (simple integer) and send to external server, like below - all is ok

:local tArr; :set $tArr [/caps-man registration-table print count-only]; :put $tArr; /tool fetch mode=http url="http://8d11b038.eu.ngrok.io/mikrotik-api/post.php" http-method=post  http-data="payload=$tArr" keep-result=no;

But if i try to send data from a print (samples below), php dumped empty payload

:local tArr; :set $tArr [/caps-man registration-table print]; :put $tArr; /tool fetch mode=http url="http://8d11b038.eu.ngrok.io/mikrotik-api/post.php" http-method=post  http-data="payload=$tArr" keep-result=no;

Where is a problem? How to send data from a print?

And how to send only specific columns?


Solution

  • This happens because of the limitation of RouterOs in variable size. Maximum allowed size is 4096 byte. When you try to assign a value greater than this size - the OS assigns the value "nill". Otherwise, if you assign a value less than 4096 byte, then the variable works correctly.

    Do not allow the use of large variable.