As you can see the variable is being called $userip and produces the ip that hits a web server. I want to add that varialbe to the access-list. The Mikrotik command via CLI is
Code: Select all
/ip firewall address-list
add address=variable list=PublicAuthorised
Code: Select all
<?php
require('routeros_api.class.php');
$userip = $_SERVER['REMOTE_ADDR']; //DHCP IP that hits Server
$API = new routeros_api();
$API->debug = true;
if ($API->connect('x.x.x.x', 'xxxxxxxxx', 'xxxxxxxxxxxxxxxx')) {
$API->write('/interface/getall'); //This is where I am going wrong and appreciate input
print_r($userip); //Printing of IP that hits server
$API->disconnect();
}
?>