<?php
  error_reporting(E_ALL);
  require_once('snmp.php');

  $ip = '172.16.0.65'; 		// ip address or hostname
  $ips = array($ip, '172.16.0.64');	// array of ip addresses or hostnames
  $community = 'public';	// community string
  $oid = '.1.3.6.1.2.1.1';	// only numerical oids are supported

  $snmp = new snmp();

//  $snmp->version = 2;	// version 2 is not fully tested/working

  print_r($snmp->walk($ip, $oid, $community));
  print_r($snmp->multi_walk($ips, $oid, $community));

  // get system uptime
  print_r($snmp->get($ip, '.1.3.6.1.2.1.1.3.0', $community));
  print_r($snmp->multi_get($ips, '.1.3.6.1.2.1.1.3.0', $community));

  // reset cable modem(s)
  $oid = '.1.3.6.1.3.83.1.1.4.0.1.1.3.0';
  $snmp->set($ip, $oid, 1, 'i', 'private');
  $snmp->multi_set($ips, $oid, 1, 'i', 'private');

  // send a trap
  $ip = '123.45.12.3';
  $community = 'public';
  $varbind = $snmp->build_varbind('.1.3.6.1.3.83.1.1.4.1', 17, 'i');
  $enterprise = '.1.3.6.1.3.83.1.1.4.0.1.1.3.0';
  $agent = '127.0.0.1';
  $trap_type = TRAP_LINKUP;
  $specific_trap_type = 2;
  $uptime = 123;

  $snmp->trap($ip, $community, $varbind, $enterprise, $agent, $trap_type, $specific_trap_type, $uptime);
?>
  
