16.2 Getting an SNMP Object


You want to get the value of a certain SNMP object.

Technique

Use the snmpget () function to retrieve the value of a specified object:

 <?php $contact = snmpget("localhost", "public", "system.SysContact.0"); print "The system contact is $contact"; ?> 

Comments

The snmpget() function gets the value of an SNMP object (in this case, "system. SysContact.0" ) for a specified community (in this case, "public" ) on a specified server (in this case, "localhost" ).

The same two optional arguments discussed earlier ”timeout and number of retries ”can be supplied to this function as well.



PHP Developer's Cookbook
PHP Developers Cookbook (2nd Edition)
ISBN: 0672323257
EAN: 2147483647
Year: 2000
Pages: 351

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net