Page 1 of 1

php api client for hotspot management

Posted: Fri Nov 20, 2020 4:42 pm
by leostereo
Hi guys.
Im trying to authorize a client on my hotspot through the api using php client like:
<?php

require(dirname(__FILE__).'/routeros-api/routeros_api.class.php');

$host = '192.168.89.1';

$API = new RouterosAPI();
$API->debug = false;
$API->timeout = 1;
$API->attempts = 3;

ob_start();
if ($API->connect($host, 'api_user', 'api_user')) {

   $API->comm("ip/hotspot/active/login/", array(
      "user"     => "user",
      "password" => "user123",
      "mac-address" => "C0:17:4D:B3:F7:1F",
      "ip"  => "50.1.1.199",
   ));

   $READ = $API->read();
   $READ = $API->read(false);
   $ARRAY = $API->parseResponse($READ);

   print_r($ARRAY);

   $API->disconnect();

unset($API);
ob_end_clean();

}
?>
For some reason this is not working ,
I have no output.
There is no problem with the code , replacing the API->comm method parameter for something like (/ip/arp/print) it works.
I dont know how to debug this ...
Any idea ? Is there another way ?
Thanks!