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.

WHM Auto script...

Discussion in 'General Discussion' started by *asterisk*, Sep 23, 2005.

  1. *asterisk*

    *asterisk* Member

    Joined:
    Jul 14, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    PHP:
    #!/usr/local/cpanel/3rdparty/bin/php     
    <?php    
    require '/usr/local/cpanel/Cpanel/Accounting.php.inc';  
    $host "localhost";  
    $user "whm login";  
    $accesshash 'whm pass';    
    $accts listaccts($host,$user,$accesshash,0);  
    print_r($accts);  
    $pkgs listpkgs($host,$user,$accesshash,0);  
    print_r($pkgs);  
    ?>
    I have tried the PHP code above which I have found on the cPanel website but after trying it I get only html code in arrays.
     

    Attached Files:

  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    The value being returned to you by this function is indicating an authentication failure.

    You'd need to check that $user is the correct WHM username and that $accesshash contains the correct remote access key and NOT the WHM password.
     
  3. *asterisk*

    *asterisk* Member

    Joined:
    Jul 14, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    remote access key is in /usr/local/cpanel/Cpanel/key ?
     
  4. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    In short, no.

    You'd have to get/generate this from WHM > Cluster/Remote Access > Setup Remote Access Key
     
  5. *asterisk*

    *asterisk* Member

    Joined:
    Jul 14, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
  6. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    I assume that everything is now working fine?
     
  7. *asterisk*

    *asterisk* Member

    Joined:
    Jul 14, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    yeah it works ;)
     
Loading...

Share This Page