Community discussions

MikroTik App
dca1
刚刚加入了
Topic Author
Posts: 4
加入: Sat Aug 31, 2019 2:43 pm

Updating item in address list from php?

Sun Aug 21, 2022 2:30 pm

Hi everyone, .

I am looking to maintain a whitelist of ip's for a firewall rule but I don't want to maintain that list constantly. I plan to have a one-click webpage which will trigger an update to the list. The page will be a simple challenge/response and on submit will silently update the list if the response is valid. the intention is to locate a list entry by its comment and update the ip,never to add items.

I did some searches to see how I can interact with Router OS via PHP but couldn't find anything useful. Does anyone here have some pointers that might help me?

Thanks
Top
Sob
Forum Guru
Forum Guru
Posts: 9185
加入: Mon Apr 20, 2009 9:11 pm

Re: Updating item in address list from php?[SOLVED]

Sun Aug 21, 2022 8:20 pm

Code:Select all
connect('192.168.88.1', 'username', 'password')) { $api->write('/ip/firewall/address-list/print', false); $api->write('?comment=item1'); $response = $api->read(true); if(!empty($response)) { $api->write('/ip/firewall/address-list/set', false); $api->write('=.id='.$response[0]['.id'], false); $api->write('=address=1.2.3.4'); $response = $api->read(true); } $api->disconnect(); } ?>
https://github.com/BenMenking/routeros-api
Top
dca1
刚刚加入了
Topic Author
Posts: 4
加入: Sat Aug 31, 2019 2:43 pm

Re: Updating item in address list from php?

Tue Aug 23, 2022 9:17 am

Amazing. Thanks a lot!
Top

Who is online

Users browsing this forum:malksand 9 guests

Baidu
map