<?php
//dv at josheli.com

//read below for "explanation"

$page = @file_get_contents('http://username:password@www.mydomain.com:2082/frontend/bluelagoon/index.html','r');


$int preg_match("/SQL Disk Usage.*?<\/tr>/is",$page$match);
if(
$int) {
    
$match[0] = strip_tags($match[0]);
    echo 
$match[0];
}
else {
    echo 
'nuthin';
}

/*
[QUOTE]All I find in WHM is a "Space Used" number, which I assume does not include MySQL? Or does it?[/QUOTE] 
It does not.
[QUOTE]Is there any way to see the database usage from WHM[/QUOTE] 
No.
[QUOTE]or do I have to go to each client's cPanel? [/QUOTE] 
Yes and no.....

Most cpanel skins show "SQL Disk usage...." (Vertex does not, maybe others). Since your main reseller password will get you into cpanel, extracting this value can be easily scripted, with a few caveats. It's easiest if your clients use the same cPanel Skin, but not much of a problem if they don't. Basically, here is the script:
[quote]
$page = @file_get_contents('http://clientsUserName:resellerPassord@[url]www.clientsdomain.com:2082/frontend/x/index.html[/url]','r');

$int = preg_match("/SQL Disk Usage.*?<\/tr>/is",$page, $match);
if($int) {
    $match[0] = strip_tags($match[0]);
    echo $match[0];
}
else {
    echo 'nuthin';
}
/*
Output:
SQL Disk usage 1.18 Megabytes

 [/quote] 
This works for the x skin and redsim skin for sure. For the default skin, you need to change the url from index.html to mainmenu.html (since it is framed)...
[quote]
$page = @file_get_contents('http://clientsUserName:resellerPassord@[url]www.clientsdomain.com:2082/frontend/default/menumain.html,[/url]'r');
[/quote]
So to make this really useful, you could have all your clients' usernames in an Array, run the script from cron, and have it email you a list.

**i didn't use the [php] tags becuase it was parsing the urls in the code. still is, but oh well...
*/
/*
//redsim
$page = @file_get_contents('http://username:password@www.mydomain.com:2082/frontend/redsim/index.html','r');


$int = preg_match("/SQL Disk Usage.*?<\/tr>/is",$page, $match);
if($int) {
    $match[0] = strip_tags($match[0]);
    echo $match[0];
}
else {
    echo 'nuthin';
}
*/

/*
//default
$page = @file_get_contents('http://username:password@www.mydomain.com:2082/frontend/default/menumain.html','r');


$int = preg_match("/SQL Disk Usage.*?<\/tr>/is",$page, $match);
if($int) {
    $match[0] = strip_tags($match[0]);
    echo $match[0];
}
else {
    echo 'nuthin';
}


//x
$page = @file_get_contents('http://username:password@www.mydomain.com:2082/frontend/x/index.html','r');


$int = preg_match("/SQL Disk Usage.*?<\/tr>/is",$page, $match);
if($int) {
    $match[0] = strip_tags($match[0]);
    echo $match[0];
}
else {
    echo 'nuthin';
}
*/
//x

?>