PHP Classes

PHP Docsis Config of Cable Modem: Query cable modem configuration via SMNP

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 80 All time: 10,110 This week: 66Up
Version License PHP version Categories
cable-modem-tx-basic 1.0.0BSD License5Networking, PHP 5, Configuration, Har...
Description 

Author

This class can query cable modem configuration via SMNP.

It sends SNMP requests to a cable modem to retrieve its configuration values.

Currently it can retrieve configuration values like TX, RX, SNR and firmware version.

Innovation Award
PHP Programming Innovation award nominee
January 2017
Number 18
DOCSIS (Data Over Cable Service Interface Specification) is standard specification that defines how data can be transmitted over cable TV systems.

This package can query several aspects of the configuration of a cable modem using DOCSIS specification using SNMP queries.

Manuel Lemos
Picture of Fernando André
Name: Fernando André is available for providing paid consulting. Contact Fernando André .
Classes: 5 packages by
Country: Portugal Portugal
Age: 41
All time rank: 124316 in Portugal Portugal
Week rank: 215 Up5 in Portugal Portugal Up
Innovation award
Innovation award
Nominee: 2x

Example

<?php
require 'Docsismodem.php';

$pdo = new PDO(
   
'mysql:host=localhost;dbname=dhcp',
   
'user',
   
'password'
);

if (
array_key_exists("macaddr", $_GET)) {
   
$mac = $_GET['macaddr'];
   
$mac = str_replace(":", "", $mac);
   
$mac = str_replace(".", "", $mac);
} else {
   
$mac = "";
}

// This get's me the last ip commited to the cable modem
// I use it to know where the CM lives
// Also one can use reverse DNS if your networking is using such a thing
// check PEAR packages for DNS Queries
$sql = "SELECT macaddr, lastip, serialnum FROM docsismodem WHERE macaddr = ? ";
$pdo->beginTransaction();
$sth = $pdo->prepare($sql);
$sth->execute(array($mac));

$a = null;
foreach (
$sth->fetchAll(PDO::FETCH_CLASS) as $modem ) {
 
$dm = new DM_Model_Docsismodem();
 
$dm->ipaddr = $modem->lastip;
 
$dm->macaddr = $modem->macaddr;
 
$a = $dm->remoteQuery();
}

?>
<html>
<head>
    <title>TX Information page, <?php print $modem->macaddr ?></title>
    <LINK href="bluedream.css" rel="stylesheet" type="text/css">
</head>
<body>
<table>
<tr>
    <td><b>mac</b></td>
    <td><?php print $modem->macaddr ?> , IP: <?php print $a['ip'] ?></td>
</tr>
<tr>
    <td><b>tx</b></td>
    <td><?php print ($a['tx']/10) ?></td>
</tr>
<tr>
    <td><b>snr</b></td>
    <td><?php print ($a['snr']/10) ?></td>
</tr>
<tr>
    <td><b>rx</b></td>
    <td><?php print ($a['rx']/10) ?></td>
</tr>
<tr>
    <td><b>firmware version</b></td>
    <td><?php print $a['version'] ?></td>
</tr>
<tr>
    <td>
    <form action="" method="get" name="p">
        <input type="text" name="macaddr" value="<?php print $mac ?>" />
        <input type="submit" value="Ver" />
    </form>
    </td>
</tr>
</table>
</body>
</html>


Details

Simple webpage and PHP class to get cable modem information via SNMP Requires a docsisserver style docsismodem database to work but if you use dynamic DNS with isc DHCP you can use the PEAR Package for DNS Queries for name to IP resolution in my case I used the commited "hook" from isc dhcp server.

  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file bluedream.css Data Auxiliary data
Plain text file Docsismodem.php Class Class source
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file README Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:80
This week:0
All time:10,110
This week:66Up