downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

snmp_set_valueretrieval> <snmp_set_oid_output_format
Last updated: Fri, 20 Nov 2009

view this page in

snmp_set_quick_print

(PHP 4, PHP 5)

snmp_set_quick_printSet the value of quick_print within the UCD SNMP library

Description

void snmp_set_quick_print ( bool $quick_print )

Sets the value of quick_print within the UCD SNMP library. When this is set (1), the SNMP library will return 'quick printed' values. This means that just the value will be printed. When quick_print is not enabled (default) the UCD SNMP library prints extra information including the type of the value (i.e. IpAddress or OID). Additionally, if quick_print is not enabled, the library prints additional hex values for all strings of three characters or less.

By default the UCD SNMP library returns verbose values, quick_print is used to return only the value.

Currently strings are still returned with extra quotes, this will be corrected in a later release.

Parameters

quick_print

Return Values

No value is returned.

Examples

Setting quick_print is often used when using the information returned rather then displaying it.

Example #1 Using snmp_set_quick_print()

<?php
snmp_set_quick_print
(0);
$a snmpget("127.0.0.1""public"".1.3.6.1.2.1.2.2.1.9.1");
echo 
"$a\n";
snmp_set_quick_print(1);
$a snmpget("127.0.0.1""public"".1.3.6.1.2.1.2.2.1.9.1");
echo 
"$a\n";
?>

The above example will output something similar to:

'Timeticks: (0) 0:00:00.00'
'0:00:00.00'

See Also



add a note add a note User Contributed Notes
snmp_set_quick_print
helbertfernandes at yahoo dot com dot br
02-Dec-2008 02:06
#!/usr/bin/php
<?php
$host
='host';
$community='community';
$oid='1.3.6.1.2.1.1'; //system

snmp_set_quick_print(0);
print_r(snmpwalkoid($host,$community,$oid));
snmp_set_quick_print(1);
print_r(snmpwalkoid($host,$community,$oid));
?>
Array
(
    [RFC1213-MIB::sysDescr.0] => STRING: "Cisco Internetwork Operating System Software
IOS (tm) RSP Software (RSP-PV-M), Version 12.3(22), RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by cisco Systems, Inc.
Compiled Wed 24-Jan-07 23:56 by"
    [RFC1213-MIB::sysObjectID.0] => OID: SNMPv2-SMI::enterprises.9.1.46
    [DISMAN-EVENT-MIB::sysUpTimeInstance] => 1471787856
    [RFC1213-MIB::sysContact.0] => STRING: "contact"
    [RFC1213-MIB::sysName.0] => STRING: "host"
    [RFC1213-MIB::sysLocation.0] => STRING: "local
    [RFC1213-MIB::sysServices.0] => INTEGER: 6
    [SNMPv2-MIB::sysORLastChange.0] => 0
)
Array
(
    [RFC1213-MIB::sysDescr.0] => "Cisco Internetwork Operating System Software
IOS (tm) RSP Software (RSP-PV-M), Version 12.3(22), RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by cisco Systems, Inc.
Compiled Wed 24-Jan-07 23:56 by"
    [RFC1213-MIB::sysObjectID.0] => SNMPv2-SMI::enterprises.9.1.46
    [DISMAN-EVENT-MIB::sysUpTimeInstance] => 1471787859
    [RFC1213-MIB::sysContact.0] => "contact"
    [RFC1213-MIB::sysName.0] => "host"
    [RFC1213-MIB::sysLocation.0] => "local"
    [RFC1213-MIB::sysServices.0] => 6
    [SNMPv2-MIB::sysORLastChange.0] => 0
)

snmp_set_valueretrieval> <snmp_set_oid_output_format
Last updated: Fri, 20 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites