2017-05-31 44 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