Community discussions

 
kraker
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 88
Joined: Thu Aug 02, 2012 9:34 am

Add user to userman with php api

Sat Aug 09, 2014 11:32 am

Hi Ros:6.7v

I have try to add user to userman with php api.But it show's ok at easy php side.At userman side it doesn't shown new added user.

<?php
require('C:\Program Files\EasyPHP-12.1\www\my portable files/class routeros_api.php');
$API = new routeros_api();
$API->debug = true;
if ($API->connect('192.168.3.1', 'userapi', '1234'))
{
$API->write('/tool/user-manager/user/add', false);
$API->write('customer=admin=name=tt=password=1234', false);
$API->disconnect();

}
?>

How can ı add user to userman with php api?
thanks...
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Add user to userman with php api

Sat Aug 09, 2014 2:40 pm

Huh... deja vu... I remember answering a question with pretty much the same problem... ah... this one...... OK, it's a little different, but still... it's the same problem. Each API word needs to be a new method call.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
kraker
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 88
Joined: Thu Aug 02, 2012 9:34 am

Re: Add user to userman with php api

Sat Aug 09, 2014 2:47 pm

solved with this code..

<?php
require('C:\Program Files\EasyPHP-12.1\www\my portable files/class routeros_api.php');
// new object api
$API = new routeros_api();
$API->debug = true;
if ($API->connect('192.168.3.1', 'userapi', '1234') ) {

$ARR=$API->comm("/tool/user-manager/user/add",Array(
"customer" => "admin",
"name" => "11",
"password" => "11",
"shared-users" => "1",
"copy-from" => "1D",
));


$API -> disconnect();

}
?>

thanks...

Who is online

Users browsing this forum: No registered users and 3 guests