monabhai420

Registered
May 5, 2012
2
0
51
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 = '[email protected]';

$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
 

charsleysa

Active Member
Jul 18, 2011
41
0
56
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;