|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-04-26 19:33 UTC] marty at upbeatmms dot com
Description:
------------
In the following code below the OID is not displayed - just the data. The command line version of UCD-SNMP displays both the OID and Data.
Reproduce code:
---------------
<?php
snmp_set_quick_print(0);
$a = snmpwalk("192.168.1.1", "Read",".1.3.6.1.2.1.17.4.3.1.1");
foreach ($a as $val) {
echo "$val\n<br>";
}
?>
Expected result:
----------------
I excpect to see both the OID and the data
Actual result:
--------------
Just the data is displayed
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 03:00:01 2025 UTC |
Updated Code (still not working but displays the keys): <?php snmp_set_quick_print(0); echo "find Mac address in above results - make note of OID<br>"; $a = snmpwalk("192.168.1.1", "read",".1.3.6.1.2.1.17.4.3.1.1"); $keys=array_keys($a); while (list($key, $val) = each($a)) { echo "$key => $val\n<br>"; } ?> Here is the output from the code: 0 => Hex: 00 06 5B F3 A9 84 1 => Hex: 00 08 7C EB 54 80 2 => Hex: 00 0C 41 9B B3 31 3 => Hex: 00 12 43 B1 13 06 4 => Hex: 00 A0 C9 25 C8 DE 5 => Hex: 00 D0 01 5F 54 00 6 => Hex: 00 D0 01 75 64 00 7 => Hex: 00 D0 01 75 A8 00 8 => Hex: 00 D0 B7 7A 1D 9E 9 => Hex: 00 D0 B7 94 22 5C ================================================== Here is the output using the snmpwalk from UCD SNMP: .iso.3.6.1.2.1.17.4.3.1.1.0.6.91.243.169.132 = Hex: 00 06 5B F3 A9 84 .iso.3.6.1.2.1.17.4.3.1.1.0.8.124.235.84.128 = Hex: 00 08 7C EB 54 80 .iso.3.6.1.2.1.17.4.3.1.1.0.12.65.155.179.49 = Hex: 00 0C 41 9B B3 31 .iso.3.6.1.2.1.17.4.3.1.1.0.18.67.177.19.6 = Hex: 00 12 43 B1 13 06 .iso.3.6.1.2.1.17.4.3.1.1.0.160.201.37.200.222 = Hex: 00 A0 C9 25 C8 DE .iso.3.6.1.2.1.17.4.3.1.1.0.208.1.95.84.0 = Hex: 00 D0 01 5F 54 00 .iso.3.6.1.2.1.17.4.3.1.1.0.208.1.117.100.0 = Hex: 00 D0 01 75 64 00 .iso.3.6.1.2.1.17.4.3.1.1.0.208.1.117.168.0 = Hex: 00 D0 01 75 A8 00 .iso.3.6.1.2.1.17.4.3.1.1.0.208.183.122.29.158 = Hex: 00 D0 B7 7A 1D 9E .iso.3.6.1.2.1.17.4.3.1.1.0.208.183.148.34.92 = Hex: 00 D0 B7 94 22 5C Hope the additional info will help.