//Returns assoc array of bandwidth used
//You need to change the URL a bit to suit your needs
function getband() {
    $url = 'http://HOSTNAME/bandwidth/index.cgi?action=showhost&month='.date('M').'&year='.date('Y').'&host=IPADD';
    $handle = fopen($url, "r");
    $contents = '';
    while (!feof($handle)) {
        $contents .= fread($handle, 8192);
    }
    fclose($handle);
    preg_match_all("/\<td class\=total\>(.*?)\<\/td\>/is", $contents, $matches);
    $ret['GB'] = $matches[1][1];
    $ret['MB'] = $matches[1][2];
    return $ret;
}

//Call it
getband();

You need to change IPADD and HOSTNAME where appropriate. I will revamp this script when I have time[jason].

Back
MysticServer

Category
CategorySite5
Total Hits: 2710

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki