Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Comma separator while retrieving cpanel account data with api

Discussion in 'cPanel Developers' started by falkor, Feb 11, 2014.

  1. falkor

    falkor Registered

    Joined:
    Aug 12, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    151
    I am using the code below to retreive cpanel account data:

    include("cpanel.php");

    $ip="127.0.0.1";
    $port=2083;

    $account='some-account';
    $passwd='some-password';

    $xmlapi=new xmlapi($ip);
    $xmlapi->password_auth($account,$passwd);
    $xmlapi->set_port($port);

    $call=array('display' => 'diskusage|bandwidthusage');
    $result=$xmlapi->api2_query($account,'StatsBar','stat',$call);

    $diskusage=$result->data[0]->count;
    $bandwidthusage=$result->data[1]->count;

    echo $diskusage; // and I get: 25,274,9
    echo $bandwidthusage; // and I get: 10,477,08

    The problem is I am getting comma as thousands separator
    and also comma as decimal point.
     
  2. morissette

    morissette Well-Known Member

    Joined:
    May 24, 2009
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    66
    Location:
    Austin, TX
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice