PHP CPanel info script

Status
Not open for further replies.

Hyper X

New Member
Messages
3
Reaction score
0
Points
0
<P>Hey guys i am making an account login for my site and was wondering if there was a script that could display the users CPanel bandwidth usage and other information about their CPanel account.</P>
<P>&nbsp;</P>
<P>Thanks in advance guys</P>
 

Twinkie

Banned
Messages
1,389
Reaction score
12
Points
0
Doesn't seem like it. I looked at cPanel source and the stats are added before the page loads. Can't help you with that.
 

Penguin129

New Member
Messages
68
Reaction score
0
Points
0
Here's a script for you to build off of. Just follow the basic concept and you can display a lot of stuff from cPanel.
Code:
<?php
$username = "example";
$password = "elpmaxe";
$url = "www.example.com";
ob_start();
readfile("http://{$username}:{$password}@{$url}:2082/frontend/x3/stats/bandwidth.html");
$page = ob_get_contents();
ob_end_clean();
preg_match("/<img src=bar.gif height=8 width=(.+)><img src=wbar.gif height=8 width=(.+)><\/td><td>(.+) used/", $page, $match);
$bar_used = $match[1];
$bar_free = $match[2];
$percent = $match[3];
echo "<div style=\"background-color: #006600; border: 1px solid #000000; float: left; width: {$bar_used}px;\">&nbsp;</div><div style=\"border: 1px solid #000000; float: left; width: {$bar_free}px;\">&nbsp;</div> {$percent} used.";
?>
 

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Last edited:

Hyper X

New Member
Messages
3
Reaction score
0
Points
0
Thanks Brandon and everyone else for the replies i really appreciate it.

also my friend has an account here and his Bandwidth and Disk space usage are reading zero i dont know whether its an issue i thought i'd just mention it i know for a fact his actual usages are DS: 150/300MB and BW: is 67/10000MB

i was wondering also how i might page a page that redirects and shows data from the logged in user like the one here. Thats the only thing i remain stuck on.

so i would appreciate any help on this people could offer.
 
Status
Not open for further replies.
Top