2

I am using a third party class that works well as long as I use it in the main body of my PHP script. If I try to use it in a function that is called from main, it gets a "PHP Fatal error: Class 'RouterOS\Util' not found error". What do I need to do in the function so it can use the class?

<?php
require_once '/usr/local/sbrc/MTAPI/vendor/autoload.php';
...
    GetNextRouter($loginData[0]['User'], $loginData[0]['Password'], $firstAddress[0]['IPAddress']);
...
}
function GetNextRouter($UserID, $Pass, $Address) {
        $util = new RouterOS\Util($client = new RouterOS\Client($Address, $UserID, $Pass));
...
}

The error occurs on the $util = new RouterOS\Util line.

Scott Reed
  • 31
  • 4

1 Answers1

0

Adding use PEAR2\Net\RouterOS; solved my issue

Scott Reed
  • 31
  • 4