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.

Result of user creation script

Discussion in 'cPanel Developers' started by angela zou, Jan 12, 2012.

  1. angela zou

    angela zou Member

    Joined:
    Dec 25, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    I'm running a user creation script that basically has the following structure:
    PHP:
      $script "http://{$whm_user}:{$whm_pass}@{$whm_host}:2086/scripts/wwwacct";
      
    $params "?plan={$result->user_plan}&domain={$result->user_domain}&username={$result->user_name}&password={$result->user_pass}&contactemail={$result->user_email}";
      
    $result file_get_contents($script.$params);
    I don't want the script to output anything unless there is an error (when it's successful, it's redirected to another page). So, I need to test the success of file_get_contents($script.$params). So, what is the output of $result when it is and is not successful?

    Angela
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    That script is incompatible with contemporary versions of cPanel&WHM, especially servers where CSRF protection is enabled. I would advise you use our APIs rather than something like that which calls a URL directly and thus sends your username and password in plain text (a very bad idea).

    I assume you're programming in PHP. You can download a PHP class which includes a call to creating an account as part of its examples, this can be downloaded from: http://github.com/CpanelInc/xmlapi-php

    Details of the output returned by this function is posted in our SDK documentation at: CreateAccount < SoftwareDevelopmentKit < TWiki
     
Loading...

Share This Page