Mikrotik API is giving error response

Hello Everyone,

Anyone know how to get torch data from mikrotik router using API.

We are using PHP API mentioned below, but its giving me the response like "no such command prefix".

API Request :

require('routeros_api.class.php');
require('config.php');

$API = new RouterosAPI();

$API->debug = false;
$interface = $argv[1];
if ($API->connect(IP_ADDRESS, USERNAME, PASSWORD))
{
	$API->write('/tool/torch');
	$API->write("=interface=$interface");
	$READ= $API->read(false);
	$ARRAY = $API->parseResponse($READ);
    print_r($ARRAY);
}

Response :

Array
(
    [!trap] => Array
        (
            [0] => Array
                (
                    [message] => no such command prefix
                )

        )

)

Not only torch API, all APIs are giving the same result. Example When we are requesting to get interface details its giving the same, API request and respone mentioned below.

API Request

$API->write("/interface/$interface");
$READ = $API->read(false);
$ARRAY = $API->parseResponse($READ);
print_r($ARRAY);

API Response:

Array
(
    [!trap] => Array
        (
            [0] => Array
                (
                    [category] => 0
                    [message] => no such command or directory (Psychz)
                )

            [1] => Array
                (
                    [message] => no such command
                )

        )

)

Can anyone please provide me some solution to make it work.