Community discussions

MikroTik App
 
User avatar
leostereo
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 76
Joined: Thu Oct 18, 2012 11:36 pm
Location: mendoza , argentina
Contact:

php api client for hotspot management

Fri Nov 20, 2020 4:42 pm

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!

Who is online

Users browsing this forum: ilium007 and 8 guests