Search code examples
phpwarningssnmp

php warning redirect


I use snmp2_real_walk function.

$tmp = snmp2_real_walk($ip, '***'.$vlan, $title, 100000,10);

When oid is correct and the device is working i get the desired output. But i want to handle warnings: Invalid object identifier... or No response from 192.168.19.249... or whatever. My problem is: how can i either redirect those warnings into my variable?

or is there some another function which shows these warnings?

Thanks!


Solution

  • You could also have a look at set_error_handler to set your own error handler for this specific case, and then restore the error handler after making the function call.