View Single Post
  #8 (permalink)  
Old 09-05-2007, 08:59 AM
cPanelDavidG's Avatar
cPanelDavidG cPanelDavidG is offline
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 8,117
cPanelDavidG is on a distinguished road
Quote:
Originally Posted by kubel View Post
I just simply did not include the constructor for my class in my original post because I didn't think it was relevant. Here it is below.

PHP Code:
function cPanelInterface()  {
            require_once(
'/home/minihost/cPanelSetup.inc.php');
            
            
$this->URL =     'http://' $this->User ':' $this->Password '@' $this->Domain ':' $this->Port;
        } 
cPanelSetup.inc.php gives all the values and constructs them into the following string:

http://minihost:mypassword@minihost.org:2086

That is the $this->URL. It will just take that value and append the xml-api call. Is that incorrect?
Ensure that you can open URLs from file IO functions. This functionality can be disabled in php.ini (allow_url_fopen).

I don't want to cross the line into discussing PHP code itself rather than how to get your PHP code to work with cPanel/WHM. However, I would recommend you put in some debugging code to ensure that you are calling the URL you think you are calling.

I cannot think of anything relating to the API off-hand that would result in a blank page. However, many things that could go unnoticed in PHP code can cause a variable to be blank when it should contain data.

(Likely to be) Common Errors:

Note that if you attempt to do http://...:2087, you will get an Internal Server Error saying (among other things) "Please Speak SSL on this port" as port 2087 is dedicated to https:// connections to cpservd.

If you call an API function that doesn't exist, you'd at least get an HTML comment with a copyright notice in the body.

If you called the server with incorrect login credentials, you'd get a login page returned in the body.

If you call a file that doesn't exist (e.g. /xmlapi instead of /xml-api), you will get a 404 Not Found error (with accompanying body text)
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net
-- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative
Reply With Quote