The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XML API result Access denied

Discussion in 'cPanel Developers' started by Rigina, Sep 14, 2011.

  1. Rigina

    Rigina Registered

    Joined:
    Sep 14, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,
    Please help in the following question:

    I use PHP XML API class for query cpanel

    $ip = "xxxxxx";
    $pass = "yyyyyy";

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("root",$pass);
    $xmlapi->set_output('xml');
    $xmlapi->set_debug(1);
    $Result=$xmlapi->listips ();


    result - Access denied

    with this data I can log into cpanel
    What's wrong? Help me, please.
     
  2. pusan1983

    pusan1983 Member

    Joined:
    Aug 31, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    this works very well for me:

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth($root_uname,$root_pass);
    $xmlapi->set_output('json');
    $xmlapi->set_debug(0);
    $obj = json_decode($xmlapi->version(),true);
    print_r($obj);

    you may want to check out: WHM > security center > Configure Security Policies > XML-API and JSON-API requests (its unchecked on my whm)

    and dont forget to check out : whm > security center > cPHulk Brute Force Protection (is your IP banned?)

    btw, im not official person. i just shared my ideas. i hope you would solve your problem, regards
     
  3. Rigina

    Rigina Registered

    Joined:
    Sep 14, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thank you for your response, I took advantage of
    Your advice.
    WHM > security center > Configure Security Policies > XML-API and JSON-API requests (its unchecked on my whm)
    My IP is not banned.
    But the same result - Array ([data] => Array ([reason] => Access denied [result] => 0) [type] => text)
     
  4. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    There can be numerous reasons for this type of error - generally this occurs because of an authentication mismatch error.

    You can check the headers that are being sent to the server by turning on log-http-request=1 in /var/cpanel/cpanel.config and restart the daemon.

    This will log all http requests + headers to /usr/local/cpanel/logs/incoming_http_requests.log

    You'll want to look at the "Authorization" line and verify that the base64-encoded matches user:password. You can use Base 64 Decoder to decode the string.

    checkout Troubleshooting the XML-API - cPanel Integration for some more info.
     
Loading...

Share This Page