Search code examples
phpjquerynetwork-programmingtopology

draw network topology (php/jquery)


I work for the small ISP. We need to draw network topology in our project for network management. I usually have this data:

"cisco" | => "d-link" | => "d-link"

and so on...

So. Using PHP and jQuery how can i draw simple but nice topology picture? Thanks in advance! Appreciate your support.


Solution

  • In PHP, you could call out to Graphviz to make the images. There's probably a PHP wrapper for Graphviz already written out there, but it's pretty easy to call it yourself.

    For example, this input file (in example.dot):

    digraph example {
        dlink1 [label="d-link"];
        dlink2 [label="d-link"];
        cisco -> dlink1;
        cisco -> dlink2;
    }
    

    Can be converted into an image:

    $ dot -Tpng -o example.png example.dot
    

    Here's the result:

    Result from Graphviz