2017-03-01 73 views
0

我的服務器上的客戶域我在這裏搜索了很多如何託管使用的cPanel API

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來執行此操作。

回答

0

上面我建議在cPanel上創建插件域的方法。 以下,對代碼在南國產生新的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)); 
0

要與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); 
+0

嗯,這是不準確的,但我搜索了很多,在這裏找到了解決辦法。 https://documentation.cpanel.net/display/SDK/WHM+API+1+Functions+-+createacct – monu214

相關問題