How to get disk space and quota using PHP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crunch42
    Member
    • Feb 2005
    • 43

    #1

    How to get disk space and quota using PHP?

    Anyone know how to find out a cpanel account's disk space usage and disk space quote (and bandwidth usage and quota while we're at it) using a php/javascript/or maybe even perl script? The script would reside within the cpanel account whose quotas I'd want to find out. Any suggestions for resources where I might find this info would be greatly appreciated!

    Thanks,
    Julian
  • ZYV
    Senior Member
    • Sep 2005
    • 315

    #2
    Disk quotas: df. Bandwidth: impossible unless you implement cPanel API.

    Comment

    • crunch42
      Member
      • Feb 2005
      • 43

      #3
      What does df mean? It looks like the cpanel API is exactly what I'm looking for!

      The XML call https://example.com:2087/xml-api/acc...?user=username would return two XML variables disklimit and diskused.
      Last edited by crunch42; 01-07-2010, 12:26 PM.

      Comment

      • ZYV
        Senior Member
        • Sep 2005
        • 315

        #4
        df is a Unix command to check the free space on devices:

        zyv@mypride:~/Desktop$ ssh foo@bar.blah
        foo@bar.blah's password:
        Last login: Thu Dec 31 04:45:11 2009 from quux
        This computer system is for authorized users only. All activity is logged and regulary checked by systems personal. Individuals using this system without authority or in excess of their authority are subject to having all their services revoked. Any illegal services run by user or attempts to take down this server or its services will be reported to local law enforcement, and said user will be punished to the full extent of the law. Anyone using this system consents to these terms.
        [foo@cpanel666 ~]$ df
        Filesystem 1K-blocks Used Available Use% Mounted on
        ...
        /dev/root 275351420 135741232 125397488 52% /home/foo
        You can run this from PHP and trivially parse the output.

        In what concerns cPanel API, this is of course the way to go, but I was not aware of how knowledgeable you are in programming. It is not so trivial to implement properly.

        Comment

        Working...