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.

Problem with API (more server)

Discussion in 'General Discussion' started by phoenixweb, Sep 17, 2006.

  1. phoenixweb

    phoenixweb Well-Known Member

    Joined:
    Jun 3, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    I have more than 1 server and I want to run script that handle WHM Api from a server to another one.

    Is it possible?

    Actually I saw that the requests that I execute on the main server that hold the script works fine but they seem to don't work at all for the reseller account on another server.

    All the users must have root privileges?

    And if it is true, why WHM let me Setup a Remote Access Key even if I'm not logged as root?

    Can you help me?

    Thank You!
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    This is certainly possible using cPanel's PHP-based API - each function call requires a hostname. The PHP API is not really much more than a curl-based secure method of accessing certain features.

    The server to which you're connecting makes no difference. The important thing is that the user and access hash you specify must match the server to which you're connecting. The chance of the access hash being the same on two servers, even for different users let alone the same user, is very very very very small.

    Since you can't use the same access hash for more than one server, make sure you're specifying the correct access hash for the server to which you're connecting.

    Any user with access to WHM can create a remote access key, assuming they've been granted sufficient privileges.
     
  3. phoenixweb

    phoenixweb Well-Known Member

    Joined:
    Jun 3, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    I found the problem

    Thank you!

    However I have already founded what's wrong why my configuration.

    Across server remote connection NEEDS usessl = 1;

    I have tried to set this to 1 but unfortunatly my server have CURL without SSL, so don't work at all.

    HOWEVER NO ERROR WERE PRINTED WHILE I WAS DOING THIS!
    THERE WAS JUST EMPTY RESULT! PLEASE UPDATE THE cpanelerror tracer!

    I have already ask to my tech to recompile Apache with CURL+SSL enable.
    After that I'm sure everything will work fine! :)

    Thank you for your support!
     
  4. phoenixweb

    phoenixweb Well-Known Member

    Joined:
    Jun 3, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    i have installed CURL+SSL
    But it didn't work!!!!! :(

    (on the main server works fine now with $usessl = 1)

    Sigh, never said it will work of course!
     
  5. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    The API is by no means server specific - the exact same method for performing actions on the server on which the script is running is also used for performing actions on a different server.

    Therefore there is nothing special to consider when connecting to a different server.

    Just make sure you are using the correct credentials (check the access hash carefully - the same one cannot be used on more than one server).
     
  6. phoenixweb

    phoenixweb Well-Known Member

    Joined:
    Jun 3, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider

    Thank you WebIgnition for you support, more further cause you are the only one that answer to me!
    However i'm not so old to miss to copy and past the right access hash inside a mysql.

    I think the problem is that I don't have full privilege on the other server (it is of a friend of mine and i have just reseller privilege on it and not root privilege). On my server (the main that run the script) I use a username that is in the root group.

    If it's just this, i just have to wait the new server to know if i need the right privileges.
    But if it's not... i don't know what going to change in the script.

    :(
     
  7. phoenixweb

    phoenixweb Well-Known Member

    Joined:
    Jun 3, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    Don't Want To Work!

    Okey, i have a fresh server, I insert the configuration in the mysql of the new server, test... and nothing.

    Could not connect to the server.
    The script WORKS fine only on the main serer that hold the script.
    At this point the problem could be a firewall settings? Ports? Other things?

    I REALLY DO KNOW... but didn't work.
    Please help me!
    ::confused: :confused: :confused:
     
  8. mramos

    mramos Member

    Joined:
    Dec 10, 2002
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    I have similar problem. Any sugestions?

    Tks
     
  9. phoenixweb

    phoenixweb Well-Known Member

    Joined:
    Jun 3, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    Could be:

    CURL library is missing
    OpenSSL library is missing
    PORT 2087 is open only to connect in, but not for use for connect out.

    In this case ask to your datacenter to turn up the PORT 2087 (in/out data connection).
     
  10. phoenixweb

    phoenixweb Well-Known Member

    Joined:
    Jun 3, 2004
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    AH the explanation is:
    It works on the server that own the code because it perform a local connection and the firewall permit this but don't allow to speak outside.
     
Loading...

Share This Page