【问题标题】:how to host customers domain on my server using cpanel api如何使用 cpanel api 在我的服务器上托管客户域
【发布时间】:2017-03-01 14:05:41
【问题描述】:

我在这里搜索了很多

https://documentation.cpanel.net/display/SDK/Guide+to+cPanel+API+2

https://documentation.cpanel.net/display/SDK/Guide+to+cPanel+API+1

但没有找到任何正确的方法。我的要求是我需要以编程方式在我的服务器上托管一个域,我的客户通过表单向我提供其域名(例如:test.com),当他提交该表单时,我将使用它为其设置一个 wordpress 站点领域。目前我使用 cpanel api 以编程方式设置了一个子域,我的要求是在我的服务器上托管一个域,我必须使用 api 来做到这一点。

【问题讨论】:

    标签: web-hosting cpanel-xmlapi


    【解决方案1】:

    上面我已经建议了在 cpanel 上创建插件域的方法。 以下是在 WHM 或服务器上生成新的 cpanel 帐户的代码

    $xmlapi = new \xmlapi($reseller->url);
    //checking authentication of the cpanel
    $xmlapi->password_auth($reseller->username, $reseller->password);                                                   
    $xmlapi->set_port(2087);
    $xmlapi->set_output('json');
    
    $conf = array("username"=>$username,"password"=>$password,"domain"=>$domain,"pkgname"=>$package,"contactemail"=>$contactemail,"cpmod"=>"x3");
    
    $result = json_decode($xmlapi->createacct($conf));
    

    【讨论】:

      【解决方案2】:

      要连接 cpanel,您将需要 cpanel 主域、cpanel 用户名和 cpanel 密码。您将与 cpanel 建立联系,然后可以轻松创建新的插件域。创建插件域后,您可以使用单独的插件域来专门管理每个域。

          require_once '../components/xmlapi.php';
      
          $xmlapi = new \xmlapi($licence['cpanel_domain']);
          //checking authentication of the cpanel
          $xmlapi->password_auth($licence['username'],$licence['password']);
      
          $xmlapi->set_port(Yii::$app->params['domainPort']);
      
          $result = $xmlapi->api1_query($licence['password'], 'CustInfo', 'getemail', array());   
      
          // Add the "addondomain.com" addon domain.
      
          $api2args = array(
               'dir'            => 'addondomain/home/dir', 
               'newdomain'      => 'addondomain.com', 
               'subdomain'      => 'subdomain',
          );
      
          $add_addon = $xmlapi->api2('AddonDomain', 'addaddondomain', $api2args);
      

      【讨论】:

      猜你喜欢
      • 2016-08-24
      • 2020-06-28
      • 2017-10-20
      • 1970-01-01
      • 2019-04-13
      • 2020-04-27
      • 2011-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多