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.

fileman listfiles help

Discussion in 'cPanel Developers' started by monabhai420, May 5, 2012.

  1. monabhai420

    monabhai420 Registered

    Joined:
    May 5, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hello,

    I am trying to make a program to display file(file manager) list in the browser. Here is my code:

    Code:
    
    <?php
    include "/home/xxxx/public_html/backup/xmlapi.php";
    
    $ip = "example.com";
    $cp_user = 'username';
    $cp_pass = 'password';
    $confirm_email_addy = 'example@gmail.com';
    
    $dir_path = '/';
    $choser_dir = '1';
    $select_d = 'sample.html';
    $dirselect_dir ='sample.html';
    $usesameframe_dir = '0';
    
    // Instantiate object
    $xmlapi = new xmlapi($ip);
    
    // Set to use secure cPanel port
    //  you will have to alter this to 2082 if your PHP doesn't have SSL support enabled
    $xmlapi->set_port('2083');
    
    // Set cPanel credentials
    $xmlapi->password_auth($cp_user, $cp_pass);
    
    // Uncommentfor debugging
    //$xmlapi->set_debug(1);
    
    // Setup an ordinal array with arguments in proper order
    $args = array(
       
        $dir_path,         
        $choser_dir, 
    	$select_d,          
        $remote_pass,           
        $dirselect_dir,    
        $usesameframe_dir,           
       
    );
    
    // Make API1 query
    $results = $xmlapi->api1_query($cp_user, 'Fileman', 'listfiles', $args);
    
    
    
    
    
    
    ?>
    
    
    
    
    the output doesn't display on the browser. I need a help with the coding...

    Thanks
     
  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
    Does this behavior persist if you set $dir_path to '' (an empty string) ?
     
  3. charsleysa

    charsleysa Active Member

    Joined:
    Jul 18, 2011
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Palmerston North, New Zealand
    cPanel Access Level:
    Root Administrator
    You need to actually output something to the browser, there is no output whatsoever in the script you posted.
    Try something like:
    Code:
    print_r($results);
    
    This should only be used in development, in post-production use you should be custom formatting the layout so its user friendly, e.g. creating a User Interface.

    Depending on the contents of '$results' you could try something like (EXAMPLE ONLY):
    Code:
    foreach ($results as $entry)
    {
    echo "<p>$entry<p><br>\n";
    }
    
    If '$results' contains HTML already then the following would be what you are after:
    Code:
    echo $result;
    
     
Loading...

Share This Page