If you SSH to your Dreamhost webserver and run the ‘df’ command, you cannot get the actual free disk space for your disk quota at Dreamhost. Instead, you have to login to the Web Panel and manually lookup the disk space usage.
This is a set of PHP scripts that will automate all this. This is what it does:
- Use CURL to act like a web browser: goto login page; login; request status after login. It saves a cookie file to perform these steps and deletes the cookie when finished.
- The response is formatted as JSON. And the version of PHP is 4.x, which doesn’t support JSON.
- Use the included json.php file to convert the JSON into a PHP object variable. This file is from here: http://pear.php.net/pepr/pepr-proposal-show.php?id=198
To avoid markup problems, the code is posted here: http://www.tlsincubator.com/free_disk_space.html