php8.5
Home/ Manual/ snmp / snmp/ SNMP::getError

SNMP::getError

PHP function Edit on GitHub ✎

(PHP 5 >= 5.4.0, PHP 7, PHP 8)

Get last error message

Description

SNMP::getError(): string

Returns string with error from last SNMP request.

Parameters Parameters

Return Values

String describing error from last SNMP request.

Examples

SNMP::getError example

php
<?php
$session = new SNMP(SNMP::VERSION_2c, '127.0.0.1', 'boguscommunity');
var_dump(@$session->get('.1.3.6.1.2.1.1.1.0'));
var_dump($session->getError());
?>

The above example will output:

output
bool(false)
string(26) "No response from 127.0.0.1"

See Also

  • SNMP::getErrno

Source: reference/snmp/snmp/geterror.xml · from the official PHP manual (php/doc-en)