Skip to main content

Access Denied using php xml-api

Comments

5 comments

  • KostonConsulting
    [quote="nimrodm, post: 1598801"> My code is: [PHP] $result= $xmlapi->xmlapi_query('showmanager'); [/PHP]
    I'm not aware of an XML API function called 'showmanager' so that is one reason you may get an error, the other is that cPanel users don't have access to XML API functions other than the 'cpanel' function. When using port 2083 (cPanel), you'll only have access to API1, API2, (and UAPI which isn't in the XML PHP class yet), so check out their function references and use them like so: API2: [PHP] echo $xmlapi->api2_query($account, "Email", "getdiskusage", array(domain=>$email_domain, login=>$email_account) ); [/PHP] API!: [PHP] echo $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_quota, $email_domain) ); [/PHP] More info on XML API calls: [url=http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/XmlApi]XML and JSON APIs API1: [url=http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api1/WebHome]API1 Module Listing API2: [url=http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/CallingApiTwo]Calling API 2 Functions
    0
  • nimrodm
    Hi Dave, This is the showmanager function: [url=http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api1/ApiDiskUsage]DiskUsage Module Documentation It should work... Anyway, Might there be any security settings that might cause this? Something in cpanel or WHM?
    0
  • cPanelMichael
    The document you provided shows the "DiskUsage" module, but I do not see that listed anywhere in your script. You may want to use the "API Shell for cPanel" option as documented here to help get a better idea of what modules are available to you: API Shell for cPanel Thank you.
    0
  • nimrodm
    Hi, I don't actualy need the DiskUsage function I just used it for testing purpose because it's simple. I tried replacing my call to the api2 email module and getdiskusage function and I simply dont get nothing returned... This is my code now: [PHP]$ip = "my ip"; $xmlapi = new xmlapi($ip); $xmlapi->set_port('2083'); $xmlapi->set_output('json'); $root_pass="my pass"; $xmlapi->password_auth("user",$root_pass); $xmlapi->set_debug(); $email_domain = 'domain.com'; $email_account = 'email_user'; echo $xmlapi->api2_query($account, "Email", "getdiskusage", array(domain=>$email_domain, login=>$email_account) ); [/PHP] This way I simply get a blank screen. Same as before...
    0
  • KostonConsulting
    [quote="nimrodm, post: 1599732">Hi, I don't actualy need the DiskUsage function I just used it for testing purpose because it's simple. I tried replacing my call to the api2 email module and getdiskusage function and I simply dont get nothing returned... This is my code now: [PHP]$ip = "my ip"; $xmlapi = new xmlapi($ip); $xmlapi->set_port('2083'); $xmlapi->set_output('json'); $root_pass="my pass"; $xmlapi->password_auth("user",$root_pass); $xmlapi->set_debug(); $email_domain = 'domain.com'; $email_account = 'email_user'; echo $xmlapi->api2_query($account, "Email", "getdiskusage", array(domain=>$email_domain, login=>$email_account) ); [/PHP] This way I simply get a blank screen. Same as before...
    If you are literally calling: $xmlapi->password_auth("user",$root_pass);
    than this definitely won't work. "user" should be replaced with the actual username of the user you are trying to connect as and $root_pass will need to be that user's password.
    0

Please sign in to leave a comment.