I'm trying to use cPanel API to grab my disk space usage and I'm getting the following error - I'm using cPanel API. Warning: fsockopen() [function.fsockopen]: unable to connect to mywebsite.com:2082 (Connection timed out) in /home/mywebsite/public_html/cPanel.php on line 53 Disk Space Used: 0 MB This is my small test code (my real login parameters removed): include "cPanel.php"; $cPanel = new cPanel('mywebsite.com', 'username', 'password', 2082, false); echo 'Disk Space Used: ' . $cPanel->getSpaceUsed() . ' MB<br>'; PHP:
It looks like you CAN'T connect to that url. Maby you don't have permission to access sites outside your own domain!
I own the site I'm connecting to. I'm even running my small test script on that same site so I should be able to access it's cpanel account...but I can't for some reason.
The problem was my hosting providers firewall. They suggested I use "localhost" instead of the domain name. So I did that and it fixed that fsockopen() error. include "cPanel.php"; $cPanel = new cPanel('localhost', 'username', 'password', 2082, false); echo 'Disk Space Used: ' . $cPanel->getSpaceUsed() . ' MB<br>'; PHP: Now however, the Disk Space Used is 0MB and that isn't right. Username and Userpassword should connect to the target cPanel account and fetch the disk space used. Does anyone have any idea's on this issue?