<HTML ><HEAD ><TITLE >snmpwalkoid</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="SNMP functions" HREF="ref.snmp.html"><LINK REL="PREVIOUS" TITLE="snmpwalk" HREF="function.snmpwalk.html"><LINK REL="NEXT" TITLE="Socket functions" HREF="ref.sockets.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.snmpwalk.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="ref.sockets.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.snmpwalkoid" ></A >snmpwalkoid</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN86740" ></A ><P > (PHP 3>= 3.0.8, PHP 4 )</P >snmpwalkoid -- Query for a tree of information about a network entity </DIV ><DIV CLASS="refsect1" ><A NAME="AEN86743" ></A ><H2 >Description</H2 >array <B CLASS="methodname" >snmpwalkoid</B > ( string hostname, string community, string object_id [, int timeout [, int retries]])<BR ></BR ><P > Returns an associative array with object ids and their respective object value starting from the <TT CLASS="parameter" ><I >object_id</I ></TT > as root and <TT CLASS="constant" ><B >FALSE</B ></TT > on error. </P ><P > <B CLASS="function" >snmpwalkoid()</B > function is used to read all object ids and their respective values from an SNMP agent specified by the <TT CLASS="parameter" ><I >hostname</I ></TT >. Community specifies the read <TT CLASS="parameter" ><I >community</I ></TT > for that agent. A <TT CLASS="constant" ><B >NULL</B ></TT > <TT CLASS="parameter" ><I >object_id</I ></TT > is taken as the root of the SNMP objects tree and all objects under that tree are returned as an array. If <TT CLASS="parameter" ><I >object_id</I ></TT > is specified, all the SNMP objects below that <TT CLASS="parameter" ><I >object_id</I ></TT > are returned. </P ><P > The existence of <B CLASS="function" >snmpwalkoid()</B > and <A HREF="function.snmpwalk.html" ><B CLASS="function" >snmpwalk()</B ></A > has historical reasons. Both functions are provided for backward compatibility. <DIV CLASS="informalexample" ><A NAME="AEN86777" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >$a = snmpwalkoid("127.0.0.1", "public", "");</PRE ></TD ></TR ></TABLE ><P ></P ></DIV > </P ><P > Above function call would return all the SNMP objects from the SNMP agent running on localhost. One can step through the values with a loop <DIV CLASS="informalexample" ><A NAME="AEN86780" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >for (reset($a); $i = key($a); next($a)) { echo "$i: $a[$i]<br>\n"; }</PRE ></TD ></TR ></TABLE ><P ></P ></DIV > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.snmpwalk.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="ref.sockets.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >snmpwalk</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.snmp.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Socket functions</TD ></TR ></TABLE ></DIV ></BODY ></HTML >