(PHP 8 >= 8.6.0)
snmp_set_string_output_format — Set the output format of string values
Sets the format in which the Net-SNMP library prints the
string values returned by the SNMP functions, such as
snmp2_get() or snmp2_real_walk().
The format only applies to string values whose MIB
object has no DISPLAY-HINT.
A new SNMP object takes its initial string output format from the value set with this function. To change it for a single session, use SNMP::setStringOutputFormat() instead.
formatThe format to use. See Snmp\StringOutput for the available formats.
Nenhum valor é retornado.
Exemplo #1 Printing a binary string as text
<?php
echo snmp2_get('localhost', 'public', 'SNMP-FRAMEWORK-MIB::snmpEngineID.0'), PHP_EOL;
snmp_set_string_output_format(Snmp\StringOutput::Ascii);
echo snmp2_get('localhost', 'public', 'SNMP-FRAMEWORK-MIB::snmpEngineID.0'), PHP_EOL;
?>O exemplo acima produzirá algo semelhante a:
Hex-STRING: 80 00 1F 88 80 1C FC 9A 1B 26 7B FF 6A 00 00 00
00
STRING: ".........&{.j...."