Quantcast
Viewing all articles
Browse latest Browse all 13537

Create custom dashboard based on api results

So I'm trying to expand on this post Orion API via PHP.  The post is about 2 years old, but I tried to follow it up with what I've been working.  I haven't received any responses, so I figured I would just start a new thread and see what happens.  So based off that post I shorted it up a bit, turning his callapi into another function.  The result is this:

        <?php include 'includes/functions.php';

        $data = array('query' => "SELECT Sysname,StatusLED  FROM Orion.Nodes WHERE StatusLED = 'Down.gif'");

        $jdata = json_encode($data);

       $result = array(CallAPI($url, $jdata));

       foreach ($result as $r) {

          echo $r;

         echo "<br>";

       }

And this works for the most part.  It displays {"results":[{"Sysname":"Firewall","StatusLED":"Down.gif "},{"Sysname":"Server","StatusLED":"Down.gif "}]}.  But thats not pretty.  When its finished I would like to build a custom display based off this information, and some conditional statements based on StatusLED.  So Im not sure how to parse this data in its form, through in some HTML and CSS, and make it look pretty.  I've tried putting it in array, and echoing it like so echo $result['Sysname'] for example, but that doesn't seem to work well. 


Viewing all articles
Browse latest Browse all 13537

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>