$oid1 = 'SNMPv2-MIB::sysContact.0';
$oldvalue1 = $session->get($oid1);
$newvalue1 = $oldvalue1 . '0';
$z = $session->set($oid1, 's', $newvalue1);
var_dump($z);
var_dump($session->get($oid1) === $newvalue1);
$z = $session->set($oid1, 's', $oldvalue1);
var_dump($z);
var_dump($session->get($oid1) === $oldvalue1);
var_dump($session->close());
echo "Multiple OID with max_oids = 1\n";
$oid2 = 'SNMPv2-MIB::sysLocation.0';
$session = new SNMP(SNMP::VERSION_3, $hostname, $rwuser, $timeout, $retries);
$session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass);
$session->max_oids = 1;
$oldvalue2 = $session->get($oid2);
$newvalue2 = $oldvalue2 . '0';
$z = $session->set(array($oid1, $oid2), array('s', 's'), array($newvalue1, $newvalue2));
var_dump($z);
var_dump($session->get($oid1) === $newvalue1);
var_dump($session->get($oid2) === $newvalue2);
$z = $session->set(array($oid1, $oid2), array('s', 's'), array($oldvalue1, $oldvalue2));
var_dump($z);
var_dump($session->get($oid1) === $oldvalue1);
var_dump($session->get($oid2) === $oldvalue2);
var_dump($session->close());
echo "SNMPv3, setting contextEngineID (authPriv)\n";
$session = new SNMP(SNMP::VERSION_3, $hostname, $rwuser, $timeout, $retries);
$session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 'aeeeff');
var_dump($session->get('.1.3.6.1.2.1.1.1.0'));
var_dump($session->close());
<?php

require_once dirname(__FILE__) . '/snmp_include.inc';
//EXPECTF format is quickprint OFF
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
$session = new SNMP(SNMP::VERSION_3, $hostname, $user_noauth, $timeout, $retries);
$session->setSecurity('noAuthNoPriv');
#echo "Checking error handling\n";
var_dump($session->setSecurity());
var_dump($session->setSecurity(''));
var_dump($session->setSecurity('bugusPriv'));
var_dump($session->setSecurity('authNoPriv', 'TTT'));
var_dump($session->setSecurity('authNoPriv', 'MD5', ''));
var_dump($session->setSecurity('authNoPriv', 'MD5', 'te'));
var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'BBB'));
var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', ''));
var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', 'ty'));
var_dump($session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', 'test12345', 'context', 'dsa'));
var_dump($session->close());