Dragging data out of Prizm via PHP and SOAP.

Hi, all. Feels kinda lonely in here, hope I can start the ball rolling.

First off, to state my goal here, I’m working on a MS Virtual Earth live map of my network. I had one running for my old 802.11 network (now retired), so the logic is no problem, but I seem to be running into an inconsistency with the XML stuff, which I’m just getting into with this project.

I’m using PHP and NuSOAP, which seems to be working okay.

The following code is where things go south.


echo “<table border=1><tr><th>Site Name</th><th>Latitude</th><th>Longitude</td></tr>”;
for ($id = 20; $id <= 254; $id++) {
$result=$client->call(‘getPrizmElements’,array(‘Management IP’,‘10.xx.xx.’ . $id,’=’));
if(!$err=$client->getError()) {
echo “<tr><td>” . $result[0][‘elementName’] . “</td>” .
“<td>” . $result[0][‘attributeNames’][89] . " - " . $result[0][‘attributeValues’][89] . “</td>” .
“<td>” . $result[0][‘attributeNames’][106] . " - " . $result[0][‘attributeValues’][106] . “</td></tr>”;
}
else {
echo '<tr><td colspan=3>Error: ’ . $err . ‘</td></tr>’;
}
}
echo “</table>”;


The problem is that I get about 80 percent of the entries back without the correct fields. Is the field order fluid and I’m skipping a step, or am I screwing something up somewhere else?

Here’s a sample of my output:



The second line is correctly returning what I’m after.

Any ideas?

The Field List and Order of items is specific to each element. Therefore, you probably don’t want to hardcode the index into the returned arrays. If you want to generate a list of GPS Information, then you want to search the name array for the “GPS Latitude”, “GPS Longitude” fields, and use that index for retrieving the value.

The field/value arrays are more readily accessible if you load them into a hash map and do lookups on it.

Cool, thanks. I had already started going in that direction. I appreciate the confirmation.