I am attempting to build a web-proxy script using the API via the PEAR2 NetRouterOS package for PHP.
As a test I am using the AddRequest function given as an example in the wiki of the NetRouter package though I am having problems using it for the web proxy.
<?php
use PEAR2\Net\RouterOS;
include_once 'PEAR2_Net_RouterOS-1.0.0b3.phar';
$client = new RouterOS\Client('192.168.0.1', 'my-user', 'some-password');
$responses = $client->sendSync(new RouterOS\Request('/ip/proxy/access/add'));
$addRequest->setArgument('src-addresss', '192.168.0.164');
$addRequest->setArgument('dst-host', '*google.co*');
$addRequest->serArgument('action', 'allow');
if ($client->sendSync($addRequest)->getType() !== RouterOS\Response::TYPE_FINAL) {
die("Error occured while adding domain");
}
?>
It works, it creates an entry in the Access List for the Web Proxy but the fields “src-address” and ‘dst-host’ are left bank but happily’s add the “allow” into the Action field.
Is there something I’m doing wrong, or any one has advice on how I should do this?
Thanks.