2017-05-31 43 views
0

我得到了類對象代碼,它有助於在cpanel中創建目錄,但代碼需要一個庫或類。名字是cpanel.php 我需要這個庫或類,任何人都可以幫助我嗎?如何在cPanel中創建目錄cPanel api的幫助

我只想在cPanel api的幫助下創建目錄或上傳文件。

這裏是幫助檢查創建directory code的cpanel API的url。

(LiveAPP PHP類) 在此先感謝, 更大的幫助將是真正可觀的!

回答

0

您需要按照以下步驟操作,使用的cPanel API

require_once '../components/xmlapi.php'; 

    $xmlapi = new \xmlapi($cpanel_domain); 

    $xmlapi->password_auth($username,$password); 

    $xmlapi->set_port(2083); 

    $result = $xmlapi->api1_query($password, 'CustInfo', 'getemail', array()); 

    if(isset($result->error) && $result->error!=""){ 
     // error log here 
    } 

    $api2args = array(
     'path'=> 'public_html', 
     'name' => $newdir_name, 
     'permission' => '0755',      
    );       
    $result = $xmlapi->api2_query($cpanel_username, 'Fileman', 'mkdir', $api2args); 

你可以從這裏下載爲此所需XMLAPI文件進行DIR: - https://github.com/CpanelInc/xmlapi-php作爲其給定在這裏也正在開發者資源的一部分。 https://documentation.cpanel.net/display/SDK/Software+Development+Kit+Home