Created
January 28, 2011 21:48
-
-
Save figital/801056 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Grab the raw data feed from the filesystem | |
$filename = "DHCP_Static.asp.html"; | |
$file = file_get_contents($filename); | |
// Find the range of characters we'll scrape from the raw data feed | |
// Sure I could regex this part but I didn't :p | |
$startpos = strpos($file, "var table = new Array(") + 22; | |
$endpos = strpos($file, ");", $startpos); | |
$length = $endpos - $startpos; | |
// Scrape the file into a PHP var | |
$scrapeage = substr($file, $startpos, $length); | |
// Pull the semi-formatted data into a PHP array | |
$datalist = explode(",", $scrapeage); | |
// Calculate the total number of active DHCP leases | |
$numhosts = count($datalist) / 5; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment