(PHP 8 >= 8.6.0)
SNMP::setOidOutputFormat — Set the OID output format of the session
Sets the format in which the OIDs returned by the requests of this session are printed, for instance in the keys of the array returned by SNMP::walk().
This is the same as setting the
SNMP::$oid_output_format
property to the corresponding
SNMP_OID_OUTPUT_*
constant. It does not change the format used by the other sessions, nor by
functions such as snmp2_real_walk(); use
snmp_set_oid_output_format() for those.
formatThe format to use. See Snmp\OidOutput for the available formats.
Always returns true.
Example #1 Walking with numeric OIDs
<?php
$session = new SNMP(SNMP::VERSION_2c, 'localhost', 'public');
$session->setOidOutputFormat(Snmp\OidOutput::Numeric);
var_dump($session->walk('IF-MIB::ifDescr'));
?>The above example will output something similar to:
array(2) {
[".1.3.6.1.2.1.2.2.1.2.1"]=>
string(10) "STRING: lo"
[".1.3.6.1.2.1.2.2.1.2.2"]=>
string(12) "STRING: eth0"
}