I have a simple script to load a list of servers and then query each one for their uptime vis snmpget...
Now if I do not use an array and only call one specific server it works fine. If I call two servers using seperate snmpgets (meaning two lines of snmpgets with a specific server listed) it works fine...
If I use this array to load in a new server and check it will not work for any.
code:
<?php
function getdata($server)
{
$info = snmpget("$server", "community", ".1.3.6.1.2.1.1.3.0");
return $info;
}
$srvarr = Array();
$srvcnt=0;
$fp = fopen("c:\path\file.txt","r");
while(!feof($fp))
{
$srvarr[$srvcnt]=fgets($fp);
$srvcnt++;
}
fclose($fp);
while($srvcnt>=0)
{
$server=$srvarr[$srvcnt];
$uptime=getdata($server);
echo "$server - $uptime <BR>";
$srvcnt--;
}
?>
Any help here would be great!
-Mike