Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- $url = file_get_contents('http://stats.redeinfovias.net.br/monitoracao-cgr/index.html?login=ccm&pass=12345ccm');
- //?login=algo&pass=algo0
- echo $url;
- // Inicia o cURL
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_URL, 'http://stats.redeinfovias.net.br/monitoracao-cgr/index.html?login=ccm&pass=12345ccm');
- curl_setopt ($ch, CURLOPT_POST, 1);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, 'credentials.username=ccm&credentials.password=12345ccm');
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
- $store = curl_exec ($ch);
- echo $store;
- curl_setopt($ch, CURLOPT_URL, 'http://stats.redeinfovias.net.br/monitoracao-cgr/');
- $content = curl_exec ($ch);
- curl_close ($ch);
- */
- $cable= $_GET['cable'];
- $cmts = $_GET['cmts'];
- $node = $_GET['node'];
- $cmts_up =$_GET['up'];
- $pieces = explode("/", $_GET['cable']);
- $cmts_opt1 = $pieces[0];
- $cmts_opt2 = $pieces[1];
- $cmts_opt3 = $pieces[2];
- $cmts_completo = $cmts_opt1."_".$cmts_opt2."_".$cmts_opt3."-upstream".$cmts_up;
- $headers = array(
- 'Content-Type:text/html',
- 'Authorization: Basic '. base64_encode("ccm:12345ccm") // <---
- );
- $curl = curl_init();
- // http://stats.redeinfovias.net.br/cgi-bin/cricket/stats/stats.cgi?target=%2Fsnr%2FCEM%2FCMTS1%2Fcable6_0_0-upstream1;ranges=d%3Aw;view=SNR
- curl_setopt($curl, CURLOPT_URL, "stats.redeinfovias.net.br/cgi-bin/cricket/stats/stats.cgi?target=%2Fsnr%2F".$node."%2FCMTS1%2Fcable".$cmts_completo.";ranges=d%3Aw;view=SNR");
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- //$output = curl_exec($curl);
- //curl_close($curl);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- $result = curl_exec($curl);
- preg_match_all("! [^\s]*? dB<br>!", $result, $matches);
- $niveis = array_values(array_unique($matches[0]));
- //print_r($niveis);
- //echo "RX $node 18 CMTS: $cmts Cable: $cmts_opt1/$cmts_opt2/$cmts_opt2 Upstream $cmts_up SNR: ";
- //echo $niveis[0];
- //echo "<BR><hr><BR>";
- curl_close($curl);
- $pizza = "8/0/0";
- $pieces = explode("/", $_GET['cable']);
- //echo "OPT1:".$pieces[0]; // piece1
- //echo "<br>OPT2:".$pieces[1]; // piece2
- //echo "<br>OPT3:".$pieces[2]; // piece2
- $salva_niveis = $niveis[0];
- $novo= explode(" ", $salva_niveis);
- echo $novo[1];
- //print_r($novo);
- //echo "<BR><hr><BR>".$salva_niveis;
- //link = http://simop.enselengenharia.com.br/test.php?cable=8/0/0&up=1&cmts=1
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement