1

I have a problem with my PHP code. I have a firewall (ZyWALL), and can have 4 printers. The problem occurs because I can set the 161 (SNMP) port only at one printer, and not at all.

This is a screen of my ZyWall:

enter image description here

And this is my php code:

<?php
 $session = new SNMP(SNMP::VERSION_1, "xxx.xxx.xxx.xxx", "public");
 $fulltree = $session->walk(".");
 print_r($fulltree);
 echo "<br>";
 $session->close();
?>

If i set in my ZyWall for the ip: 192.168.1.204, Original port = 161 and Mapped port = 161, and in my php code i replace xxx.xxx.xxx.xxx with the correct ip with or without ":161", it work perfectly.

The problem occurs because i have plus of one printer. If for example i set in my ZyWall for the ip: 192.168.1.204, Original port = 6000 and Mapped port = 161, and in my php code i replace xxx.xxx.xxx.xxx with the correct ip with ":6000", it doesn't work.

Everyone can explain to me where is the error? Thank you

Andrea php
  • 393
  • 4
  • 21

1 Answers1

1

You can set the port for the snmp connection as shown in this question:

$sessionA = new SNMP(SNMP::VERSION_1, "192.168.1.204", "public"); //for port 161
$sessionB = new SNMP(SNMP::VERSION_1, "192.168.1.204:162", "public"); //for port 162
Community
  • 1
  • 1
SiL3NC3
  • 690
  • 6
  • 29