<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Specify the method how the SNMP values will be returned</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.snmp-set-quick-print.html">snmp_set_quick_print</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.snmp2-get.html">snmp2_get</a></div> <div class="up"><a href="ref.snmp.html">SNMP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.snmp-set-valueretrieval" class="refentry"> <div class="refnamediv"> <h1 class="refname">snmp_set_valueretrieval</h1> <p class="verinfo">(PHP 4 >= 4.3.3, PHP 5)</p><p class="refpurpose"><span class="refname">snmp_set_valueretrieval</span> — <span class="dc-title"> Specify the method how the SNMP values will be returned </span></p> </div> <div class="refsect1 description" id="refsect1-function.snmp-set-valueretrieval-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>snmp_set_valueretrieval</strong></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$method</code> <span class="initializer"> = SNMP_VALUE_LIBRARY</span> </span> )</div> </div> <div class="refsect1 parameters" id="refsect1-function.snmp-set-valueretrieval-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"> <em><code class="parameter">method</code></em> </span> <dd> <table class="doctable table"> <caption><strong>types</strong></caption> <tbody class="tbody"> <tr> <td>SNMP_VALUE_LIBRARY</td> <td>The return values will be as returned by the Net-SNMP library.</td> </tr> <tr> <td>SNMP_VALUE_PLAIN</td> <td>The return values will be the plain value without the SNMP type hint.</td> </tr> <tr> <td>SNMP_VALUE_OBJECT</td> <td> The return values will be objects with the properties "value" and "type", where the latter is one of the SNMP_OCTET_STR, SNMP_COUNTER etc. constants. The way "value" is returned is based on which one of constants <strong><code>SNMP_VALUE_LIBRARY</code></strong>, <strong><code>SNMP_VALUE_PLAIN</code></strong> is set. </td> </tr> </tbody> </table> </dd> </dt> </dl> </p> </div> <div class="refsect1 examples" id="refsect1-function.snmp-set-valueretrieval-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-4553"> <p><strong>Example #1 Using <span class="function"><strong>snmp_set_valueretrieval()</strong></span> </strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /> snmp_set_valueretrieval</span><span style="color: #007700">(</span><span style="color: #0000BB">SNMP_VALUE_LIBRARY</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">snmpget</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">, </span><span style="color: #DD0000">'public'</span><span style="color: #007700">, </span><span style="color: #DD0000">'IF-MIB::ifName.1'</span><span style="color: #007700">);<br /> </span><span style="color: #FF8000">// $ret = "STRING: lo"<br /><br /> </span><span style="color: #0000BB">snmp_set_valueretrieval</span><span style="color: #007700">(</span><span style="color: #0000BB">SNMP_VALUE_PLAIN</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">snmpget</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">, </span><span style="color: #DD0000">'public'</span><span style="color: #007700">, </span><span style="color: #DD0000">'IF-MIB::ifName.1'</span><span style="color: #007700">);<br /> </span><span style="color: #FF8000">// $ret = "lo";<br /><br /> </span><span style="color: #0000BB">snmp_set_valueretrieval</span><span style="color: #007700">(</span><span style="color: #0000BB">SNMP_VALUE_OBJECT</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">snmpget</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">, </span><span style="color: #DD0000">'public'</span><span style="color: #007700">, </span><span style="color: #DD0000">'IF-MIB::ifName.1'</span><span style="color: #007700">);<br /> </span><span style="color: #FF8000">// stdClass Object<br /> // (<br /> // [type] => 4 <-- SNMP_OCTET_STR, see constants<br /> // [value] => lo<br /> // )<br /><br /> // PHP 5.4+ examples<br /> </span><span style="color: #0000BB">snmp_set_valueretrieval</span><span style="color: #007700">(</span><span style="color: #0000BB">SNMP_VALUE_OBJECT </span><span style="color: #007700">| </span><span style="color: #0000BB">SNMP_VALUE_PLAIN</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">snmpget</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">, </span><span style="color: #DD0000">'public'</span><span style="color: #007700">, </span><span style="color: #DD0000">'IF-MIB::ifName.1'</span><span style="color: #007700">);<br /> </span><span style="color: #FF8000">// stdClass Object<br /> // (<br /> // [type] => 4 <-- SNMP_OCTET_STR, see constants<br /> // [value] => lo<br /> // )<br /><br /> </span><span style="color: #0000BB">snmp_set_valueretrieval</span><span style="color: #007700">(</span><span style="color: #0000BB">SNMP_VALUE_OBJECT </span><span style="color: #007700">| </span><span style="color: #0000BB">SNMP_VALUE_LIBRARY</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">snmpget</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">, </span><span style="color: #DD0000">'public'</span><span style="color: #007700">, </span><span style="color: #DD0000">'IF-MIB::ifName.1'</span><span style="color: #007700">);<br /> </span><span style="color: #FF8000">// stdClass Object<br /> // (<br /> // [type] => 4 <-- SNMP_OCTET_STR, see constants<br /> // [value] => STRING: lo<br /> // )<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 changelog" id="refsect1-function.snmp-set-valueretrieval-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>5.4.0</td> <td> <p class="para"> Constants <strong><code>SNMP_VALUE_PLAIN</code></strong> or <strong><code>SNMP_VALUE_LIBRARY</code></strong> may be combined with <strong><code>SNMP_VALUE_OBJECT</code></strong> resulting different way of representing contents of <em><code class="parameter">value</code></em> array element in return value of GET-function. If no <strong><code>SNMP_VALUE_{PLAIN,LIBRARY}</code></strong> constant is accompanying <strong><code>SNMP_VALUE_OBJECT</code></strong>, <strong><code>SNMP_VALUE_LIBRARY</code></strong> is used. </p> <p class="para"> Prior to 5.4.0 <strong><code>SNMP_VALUE_OBJECT</code></strong> effecively meant <strong><code>SNMP_VALUE_OBJECT</code></strong>|<strong><code>SNMP_VALUE_PLAIN</code></strong>. </p> </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 seealso" id="refsect1-function.snmp-set-valueretrieval-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.snmp-get-valueretrieval.html" class="function" rel="rdfs-seeAlso">snmp_get_valueretrieval()</a> - Return the method how the SNMP values will be returned</span> </li> <li class="member"><a href="snmp.constants.html" class="xref">Predefined Constants</a></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.snmp-set-quick-print.html">snmp_set_quick_print</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.snmp2-get.html">snmp2_get</a></div> <div class="up"><a href="ref.snmp.html">SNMP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>