rhyspaterson Posted May 27, 2008 Share Posted May 27, 2008 Hey Guys, $query = snmpget($host, $community, $oid, $timeout, $retry); Code works fine for devices that respond. However, when they don't, i get the following error: PHP Warning: snmpget() [function.snmpget]: No response from (insert device name here) The PHP manual says snmpget will return false when it fails. I have tried to catch it as below: $query = snmpget($host, $community, $oid, $timeout, $retry); if ($query == FALSE}{ echo "Device is not responding!"; exit(); } I have also tried this horrendous code: if (snmp2_get($host, $community, $oid, $timeout, $retry) == FALSE){ echo "Device is not responding!"; exit(); } But i still get the original 'no response' error that PHP throws me. I have tried using NULL and TRY/CATCH but no luck. Could anyone kick me in the right direction? Cheers! Link to comment https://forums.phpfreaks.com/topic/107399-error-catching-with-snmpget/ Share on other sites More sharing options...
rhyspaterson Posted May 28, 2008 Author Share Posted May 28, 2008 I'm wondering, is the 'No response from (insert device name here)' not an error, but something that snmpget is programmed to return.. Link to comment https://forums.phpfreaks.com/topic/107399-error-catching-with-snmpget/#findComment-551351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.