$util = new RouterOS\Util(
$client = new RouterOS\Client(‘198.168.1.1’, ‘admin’, ‘123456’)
);
How do i put PHP variable in place of ‘198.168.1.1’ so that I can select client ip from outside selection window.
saugata ray
$util = new RouterOS\Util(
$client = new RouterOS\Client(‘198.168.1.1’, ‘admin’, ‘123456’)
);
How do i put PHP variable in place of ‘198.168.1.1’ so that I can select client ip from outside selection window.
saugata ray
Same way you would put a variable anywhere. A “$”, followed by the name of the variable (with the exact name being your choice).
So f.e. if I decided to call the variable “ip”, I would write:
$ip = '192.168.1.1';
$util = new RouterOS\Util(
$client = new RouterOS\Client($ip, 'admin', '123456')
);
(on a related note, the names $util and $client are also arbitrary - you can use whatever variable names you want, as long as you use them everywhere on the page)
See tutorials like this one or this one.
Basically, you create an HTML form, and take the selection out of the $_GET or $_POST variables (depending on the form method), with the form element’s name as the array key to get.
so f.e. if you have in the HTML form:
...<form method="post">...<input type="text" name="ip" />...</form>...
then to get it from PHP, you’d use
$_POST['ip']
to get the value that was typed.