TechniqueUse the snmpwalk () function, which does exactly that: <?php $obj_array = snmpwalk("localhost", "public", ""); while ($idx < count($obj_array)) { echo "$idx. $obj_array[$idx]\n"; } ?> CommentsThe snmpwalk() function returns an array of SNMP object values starting from the object ID. (If the third argument is left as an empty string "" , all objects are fetched .) If you want to fetch all objects into an associative array where the object ID is the key and the value is the corresponding SNMP object value, use the snmpwalkoid() function: <?php $obj_array = snmpwalkoid("localhost", "public", ""); while (list($object_id, $object_value) = each($obj_array)) { echo "Object ID: $object_id\n<br>\n"; echo "Object Value: $object_value\n<br>\n<br>\n"; } ?> Please note that the snmpwalk() and snmpwalkoid() functions have two optional arguments: the timeout argument and the retry argument. The timeout argument, as its name suggests, is an integer value of how long to wait before timing out. If this argument is not set, it defaults to SNMP_DEFAULT_TIMEOUT or, in other words, it never times out. The retry argument is the number of times to retry the operation until giving up and reporting an error. If no argument is supplied, the default is SNMP_DEFAULT_RETRIES ; or, in other words, one strike and you're out. |