<HTML ><HEAD ><TITLE >snmpwalk</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="snmpset" HREF="function.snmpset.html"><LINK REL="NEXT" TITLE="snmpwalkoid" HREF="function.snmpwalkoid.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.snmpset.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.snmpwalkoid.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.snmpwalk" ></A >snmpwalk</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN86700" ></A ><P > (PHP 3, PHP 4 )</P >snmpwalk -- Fetch all the SNMP objects from an agent</DIV ><DIV CLASS="refsect1" ><A NAME="AEN86703" ></A ><H2 >Description</H2 >array <B CLASS="methodname" >snmpwalk</B > ( string hostname, string community, string object_id [, int timeout [, int retries]])<BR ></BR ><P > Returns an array of SNMP object values 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" >snmpwalk()</B > function is used to read all the values from an SNMP agent specified by the <TT CLASS="parameter" ><I >hostname</I ></TT >. <TT CLASS="parameter" ><I >Community</I ></TT > specifies the read community 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. <DIV CLASS="informalexample" ><A NAME="AEN86734" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >$a = snmpwalk("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="AEN86737" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >for ($i=0; $i < count($a); $i++) { echo $a[$i]; }</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.snmpset.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="function.snmpwalkoid.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >snmpset</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" >snmpwalkoid</TD ></TR ></TABLE ></DIV ></BODY ></HTML >