comparison doc/ucis.ano/bgp_graph/bgp_path_list_quagga.php @ 28:4dbe5bf653bb draft

Added bgp graph scripts
author ivo <ivo@UFO-Net.nl>
date Thu, 10 Jun 2010 00:15:51 +0200
parents
children
comparison
equal deleted inserted replaced
27:26b849b22eaa 28:4dbe5bf653bb
1 #!/usr/bin/php
2 <?php
3 $sock = fsockopen('localhost', 2605);
4 fread($sock, 1024);
5 fwrite($sock, "insecure\n");
6 fwrite($sock, "show ip bgp paths\n");
7 fwrite($sock, "quit\n");
8 while (!feof($sock)) {
9 $line = stream_get_line($sock, 1024, "\r\n");
10 if ($line === NULL || $line === FALSE) break;
11 if (!strlen($line) || $line[0] != '[') continue;
12 $pos = strpos($line, ') ');
13 if ($pos === FALSE) continue;
14 if ($pos == strlen($line) - 2) continue;
15 print(substr($line, $pos+2)."\n");
16 }