Dear All,
I tried to read several times the examples on the forum and wiki page how to use the API with PHP, but I'm struggling with the following script and the result I get. What I'm trying to do is the following: I would like to verify if a certain user have been already registered or not on pptp secrets list by the following script:
<?php
require('routeros_api.class.php');
$API = new routeros_api();
$API->debug = true;
if ($API->connect('192.168.2.12', 'admin', 'admin')) {
$API->write('/ppp/secret/print',false);
$API->write('=count-only=',false);
$API->write('=where=',false);
$API->write('?name=' . "ppp1");
$READ = $API->read();
$ARRAY = $API->parse_response($READ);
print_r($ARRAY);
$API->disconnect();
}
?>
ppp1 is the user registered and I should find 1 or 0 if it's registered or not in the secrets list. However as script result I get always 3 which is the total numbers of users registered.
I'm using the 3.20 ROS version.
What am I doing wrong?
Thanks