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.

PHP Remote Account Creation Script

Discussion in 'General Discussion' started by cybercom, May 31, 2003.

  1. cybercom

    cybercom Registered

    Joined:
    May 28, 2003
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I have been trying to get the PHP script for this to work for a week now. I have searched all through this forum and tried every solution listed here. Are there any settings that must be present either in WHM or on server (other than Curl, which is installed) in order for the script to work. I have used a script which another user posted (Jim) and have tried every combination of variable possible to no avail. With this script I get an error message everytime (the built in message, not PHP error) and no account creation. Am I overlooking something small. I just can't see anything wrong with the script in its present form. I would appreciate any help anyone could give. The script is as follows:

    <?php
    require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
    $host = "localhost";
    $user = "myusername";
    $accesshash = 'my access hash';



    $usessl = 1;
    $acctdomain = "testdomain.com";
    $acctuser = "user";
    $acctpass = "password";
    $acctplan= "Lite";


    $do = createacct($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);

    if (!eregi("wwwacct creation finished",$do)){
    echo "Oh no. There was a problem.";
    }

    else {
    echo "Great, the account $acctuser was created successfully.";

    }

    ?>


    Please Help!

    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:
     
  2. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    16
    Hi

    I had exactly the same problem, then I changed $usessl = 0; and it was working.

    But the response from the function is not always there. This means, even the Account is created successfully, I don't get the response.

    Michael

    cPanel.net Support Ticket Number:
     
  3. simonlee

    simonlee Active Member

    Joined:
    Jan 19, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    The problem is here:
    if (!eregi("wwwacct creation finished",$do)){

    the response from the server is various in some circumstance. You have to use "echo $do" to see what is the exact resopnse from the server in your situation, then choose the proper key word to analyse it.

    cPanel.net Support Ticket Number:
     
  4. cybercom

    cybercom Registered

    Joined:
    May 28, 2003
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the response. I have tried the setting $usessl to 1 and 0. The account is never created no matter which settings I have or even if I leave out the error message part. I am thinking that there is a setting in WHM that turns off? the ability to create accounts remotely. I cannot get my hosting company to look into this because they don't understand the issue. Does anyone know if there is such a setting?

    cPanel.net Support Ticket Number:
     
  5. simonlee

    simonlee Active Member

    Joined:
    Jan 19, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Well, if you never used this feature before. What you should do is log in to WHM, in "Server Setup" section, you will find a link named ''Setup Remote Access Key", click it and follow the instruction to create a remote access key.

    After the key created, this feature will be actived automatically.

    cPanel.net Support Ticket Number:
     
  6. cybercom

    cybercom Registered

    Joined:
    May 28, 2003
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    well, I got it to work somehow. I don't know if it was something small I overlooked or what. I hope it will continue to work :)
    Thanks to all who posted and tried to help me. It is much appreciated.

    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page