PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 79 This week: 1All time: 10,091 This week: 560Up
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: 411 Up3 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  
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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:79
This week:1
All time:10,091
This week:560Up